ssh: Print details if running the command fails

Change-Id: I87adbdd5fe4eb2709c97ab4c21b414145acf788b
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/392915
Reviewed-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Tuan Vo Hung <vohungtuan@gmail.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
This commit is contained in:
Sebastian Schuberth 2023-11-15 15:51:33 +01:00 committed by LUCI
parent 4b01a242d8
commit fff1d2d74c

8
ssh.py
View File

@ -57,8 +57,12 @@ def version():
except FileNotFoundError: except FileNotFoundError:
print("fatal: ssh not installed", file=sys.stderr) print("fatal: ssh not installed", file=sys.stderr)
sys.exit(1) sys.exit(1)
except subprocess.CalledProcessError: except subprocess.CalledProcessError as e:
print("fatal: unable to detect ssh version", file=sys.stderr) print(
"fatal: unable to detect ssh version"
f" (code={e.returncode}, output={e.stdout})",
file=sys.stderr,
)
sys.exit(1) sys.exit(1)