Merge pull request #59 from onjin/master

Support to pass command with arguments to --cmd option
This commit is contained in:
Mounier Florian
2014-11-19 17:06:58 +01:00
2 changed files with 7 additions and 6 deletions

View File

@@ -36,7 +36,8 @@ tornado.options.define("more", default=False,
tornado.options.define("host", default='localhost', help="Server host")
tornado.options.define("port", default=57575, type=int, help="Server port")
tornado.options.define("shell", help="Shell to execute at login")
tornado.options.define("cmd", help="Command to run instead of shell")
tornado.options.define("cmd",
help="Command to run instead of shell, f.i.: 'ls -l'")
tornado.options.define("unsecure", default=False,
help="Don't use ssl not recommended")
tornado.options.define("login", default=True,

View File

@@ -191,12 +191,12 @@ class TermWebSocket(Route, tornado.websocket.WebSocketHandler):
'if you want to log as different user\n')
sys.exit(1)
args = [
tornado.options.options.cmd
or tornado.options.options.shell or self.callee.shell
]
if not tornado.options.options.cmd:
if tornado.options.options.cmd:
args = tornado.options.options.cmd.split(' ')
else:
args = [tornado.options.options.shell or self.callee.shell]
args.append('-i')
os.execvpe(args[0], args, env)
# This process has been replaced