Ability to run any command instead of shell using --cmd command line parameter

This commit is contained in:
Marek Wywiał
2014-11-06 15:04:15 +01:00
parent 764a9b7884
commit dc5860e16d
2 changed files with 7 additions and 2 deletions

View File

@@ -36,6 +36,7 @@ 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("unsecure", default=False,
help="Don't use ssl not recommended")
tornado.options.define("login", default=True,

View File

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