Ensure pw file is cleaned up on kitten exit

This way it is cleaned up even if ssh fails
This commit is contained in:
Kovid Goyal 2022-03-07 06:54:11 +05:30
parent 2404eba11f
commit 6e4d3c98da
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -427,7 +427,10 @@ def main(args: List[str]) -> NoReturn:
so = init_config(overrides)
sod = {k: v._asdict() for k, v in so.items()}
cmd += get_remote_command(remote_args, hostname, options_for_host(hostname_for_match, uname, so).interpreter, sod)
os.execvp('ssh', cmd)
import subprocess
with suppress(FileNotFoundError):
raise SystemExit(subprocess.run(cmd).returncode)
raise SystemExit('Could not find the ssh executable, is it in your PATH')
if __name__ == '__main__':