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>
diff --git a/ssh.py b/ssh.py
index a824279..54a7730 100644
--- a/ssh.py
+++ b/ssh.py
@@ -57,8 +57,12 @@
except FileNotFoundError:
print("fatal: ssh not installed", file=sys.stderr)
sys.exit(1)
- except subprocess.CalledProcessError:
- print("fatal: unable to detect ssh version", file=sys.stderr)
+ except subprocess.CalledProcessError as e:
+ print(
+ "fatal: unable to detect ssh version"
+ f" (code={e.returncode}, output={e.stdout})",
+ file=sys.stderr,
+ )
sys.exit(1)