You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
765 B
Python
24 lines
765 B
Python
#!/usr/bin/env python
|
|
|
|
import optparse
|
|
import os
|
|
import shlex
|
|
import subprocess
|
|
import sys
|
|
|
|
parser = optparse.OptionParser()
|
|
parser.add_option('--user', '-l', action='store')
|
|
parser.add_option('-o', dest='options', action='append')
|
|
parser.disable_interspersed_args()
|
|
|
|
opts, args = parser.parse_args(sys.argv[1:])
|
|
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]
|
|
sys.exit(subprocess.call(args))
|