5afbe57 Always execute commands and prelude in subshell

Authored and Committed by sorlov 4 years ago
    Always execute commands and prelude in subshell
    
    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.
    This approach produces problem with some  installations
    (particularly Cygwin) which have
    /etc/bash.bash_logout file  containing invocation of "/usr/bin/clear".
    This file is executed when user logs out. When run_command() sends
    "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.
    
    Also adding test for the described scenario.
    
        
file modified
+4 -6