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