offer choices when a command fails
This commit is contained in:
parent
34883be7d5
commit
5985587b4a
20
eoptasks.py
20
eoptasks.py
|
@ -216,12 +216,26 @@ def command_window(args):
|
|||
}.get(args.cmd, args.cmd)
|
||||
if args.args:
|
||||
cmd += ' ' + ' '.join(['"%s"' % x for x in args.args])
|
||||
rc = subprocess.call(['ssh', '-t', args.command_server_name] + [cmd])
|
||||
if rc != 0:
|
||||
orig_cmd = cmd
|
||||
while True:
|
||||
rc = subprocess.call(['ssh', '-t', args.command_server_name] + [cmd])
|
||||
if rc == 0:
|
||||
send_status_message(tmux_session_name,
|
||||
{'@type': 'server-result',
|
||||
'info': {args.command_server_name: 'success'}})
|
||||
break
|
||||
send_status_message(tmux_session_name,
|
||||
{'@type': 'server-result',
|
||||
'info': {args.command_server_name: 'error'}})
|
||||
input('type enter to quit --> ')
|
||||
choice = None
|
||||
while choice not in ['r', 's', 'q']:
|
||||
choice = input('[R]etry, [S]hell, [Q]uit --> ').lower()
|
||||
if choice == 'r':
|
||||
cmd = orig_cmd
|
||||
elif choice == 's':
|
||||
cmd = 'bash'
|
||||
elif choice == 'q':
|
||||
break
|
||||
|
||||
args = parse_args()
|
||||
|
||||
|
|
Loading…
Reference in New Issue