ssh kitten: exit with 255 for unknown arg to match ssh
This commit is contained in:
parent
9c28a1ba31
commit
554c840d4e
@ -188,6 +188,9 @@ def parse_ssh_args(args: List[str]) -> Tuple[List[str], List[str], bool]:
|
|||||||
server_args.append(arg)
|
server_args.append(arg)
|
||||||
continue
|
continue
|
||||||
if arg.startswith('-') and not expecting_option_val:
|
if arg.startswith('-') and not expecting_option_val:
|
||||||
|
if arg == '--':
|
||||||
|
stop_option_processing = True
|
||||||
|
continue
|
||||||
all_args = arg[1:]
|
all_args = arg[1:]
|
||||||
for i, arg in enumerate(all_args):
|
for i, arg in enumerate(all_args):
|
||||||
arg = '-' + arg
|
arg = '-' + arg
|
||||||
@ -204,10 +207,9 @@ def parse_ssh_args(args: List[str]) -> Tuple[List[str], List[str], bool]:
|
|||||||
else:
|
else:
|
||||||
expecting_option_val = True
|
expecting_option_val = True
|
||||||
break
|
break
|
||||||
if arg == '--':
|
print('unknown option -- {}'.format(arg), file=sys.stderr)
|
||||||
stop_option_processing = True
|
subprocess.Popen(['ssh']).wait()
|
||||||
continue
|
raise SystemExit(255)
|
||||||
raise SystemExit('Unknown option: {}'.format(arg))
|
|
||||||
continue
|
continue
|
||||||
if expecting_option_val:
|
if expecting_option_val:
|
||||||
ssh_args.append(arg)
|
ssh_args.append(arg)
|
||||||
@ -267,6 +269,7 @@ def main(args: List[str]) -> NoReturn:
|
|||||||
hostname, remote_args = server_args[0], server_args[1:]
|
hostname, remote_args = server_args[0], server_args[1:]
|
||||||
if not remote_args:
|
if not remote_args:
|
||||||
cmd.append('-t')
|
cmd.append('-t')
|
||||||
|
cmd.append('--')
|
||||||
cmd.append(hostname)
|
cmd.append(hostname)
|
||||||
terminfo = subprocess.check_output(['infocmp', '-a']).decode('utf-8')
|
terminfo = subprocess.check_output(['infocmp', '-a']).decode('utf-8')
|
||||||
f = get_posix_cmd if use_posix else get_python_cmd
|
f = get_posix_cmd if use_posix else get_python_cmd
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user