From 282d0cae8913e9d20f526e7fb2633bb4e2a21fbf Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 26 Oct 2021 12:12:54 -0400 Subject: [PATCH] ssh: handle FileNotFoundError errors If ssh isn't installed, it throws a distinct error we have to catch. Bug: https://crbug.com/gerrit/15196 Change-Id: I0660e842c304ce7575f5cb100894d05fd65f9454 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/322055 Reviewed-by: Jack Neus Tested-by: Mike Frysinger --- ssh.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ssh.py b/ssh.py index 0ae8d120..450383dc 100644 --- a/ssh.py +++ b/ssh.py @@ -52,6 +52,9 @@ def version(): """return ssh version as a tuple""" try: return _parse_ssh_version() + 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) sys.exit(1)