Preserve exit code while using pseudo-terminal hack.