@ -3,6 +3,7 @@
import optparse
import optparse
import os
import os
import shlex
import shlex
import subprocess
import sys
import sys
parser = optparse . OptionParser ( )
parser = optparse . OptionParser ( )
@ -12,6 +13,11 @@ parser.disable_interspersed_args()
opts , args = parser . parse_args ( sys . argv [ 1 : ] )
opts , args = parser . parse_args ( sys . argv [ 1 : ] )
args . pop ( 0 ) # hostname
args . pop ( 0 ) # hostname
# On Linux the TTY layer appears to begin tearing down a PTY after the last FD
# for it is closed, causing SIGHUP to be sent to its foreground group. Since
# the bootstrap overwrites the last such fd (stderr), we can't just exec it
# directly, we must hold it open just like real SSH would. So use
# subprocess.call() rather than os.execve() here.
args = [ ' ' . join ( shlex . split ( s ) ) for s in args ]
args = [ ' ' . join ( shlex . split ( s ) ) for s in args ]
print args
sys . exit ( subprocess . call ( args ) )
os . execvp ( args [ 0 ] , args )