Before the fix the prelude was executed in main shell and commands were
executed in nested shell only when they were passed as a string, not as a
list. There are two problems with this approach:
1. We can invoke run_command with argument ['false', ';', 'true'] which
is equivalent to 'false ; true' but the former will fail and later will
succeed which is confusing.
2. There are installations (particularly Cygwin) which have
/etc/bash.bash_logout containing invocation of "/usr/bin/clear".
This file is executed when user logs out. When run_command() send
"exit" command to remote shell, "clear" returns exit code 1 complaining
about TERM variable not being defined, which is normal for non-interactive
sessions. Without "set -e" option this is handled correctly and shell
returns result code of last executed user command. But with "set -e" shell
terminates prematurely and when user command succeeded we receive exit
status 1.
Executing "set -e" and user commands inside subshell solves both problems.
Before the fix the prelude was executed in main shell and commands were
executed in nested shell only when they were passed as a string, not as a
list. There are two problems with this approach:
1. We can invoke run_command with argument ['false', ';', 'true'] which
is equivalent to 'false ; true' but the former will fail and later will
succeed which is confusing.
2. There are installations (particularly Cygwin) which have
/etc/bash.bash_logout containing invocation of "/usr/bin/clear".
This file is executed when user logs out. When run_command() send
"exit" command to remote shell, "clear" returns exit code 1 complaining
about TERM variable not being defined, which is normal for non-interactive
sessions. Without "set -e" option this is handled correctly and shell
returns result code of last executed user command. But with "set -e" shell
terminates prematurely and when user command succeeded we receive exit
status 1.
Executing "set -e" and user commands inside subshell solves both problems.