Skip to content

Commit

Permalink
Allow FileNotFoundError
Browse files Browse the repository at this point in the history
This happens when we try to use a non-existent git command. It happens
more often on Windows as we try to use more Git commands there.
  • Loading branch information
ajjackson committed Dec 9, 2024
1 parent 377bc55 commit fae0ce9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion build_utils/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
print(f"Trying {gitcmd} ...", file=sys.stderr)
proc = subprocess.run([gitcmd, "describe", "--tags", "--dirty"],
capture_output=True, check=True, text=True)
except subprocess.CalledProcessError as err:
except FileNotFoundError as err:
print(f"Tried {gitcmd}, File Not Found", file=sys.stderr)
except (subprocess.CalledProcessError) as err:
print(f"Tried {gitcmd}, returned: {err}", file=sys.stderr)
print(f"Stdout: '{err.stdout.strip()}'", file=sys.stderr)
print(f"Stderr: '{err.stderr.strip()}'", file=sys.stderr)
Expand Down

0 comments on commit fae0ce9

Please sign in to comment.