Catch errors calling git for commit ID

Closes gh-2468
pull/2471/head
Thomas Kluyver 9 years ago
parent 7454e8c954
commit 83e1a23ce3

@ -46,11 +46,15 @@ def pkg_commit_hash(pkg_path):
while cur_path != par_path:
cur_path = par_path
if p.exists(p.join(cur_path, '.git')):
proc = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=pkg_path)
repo_commit, _ = proc.communicate()
try:
proc = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=pkg_path)
repo_commit, _ = proc.communicate()
except OSError:
repo_commit = None
if repo_commit:
return 'repository', repo_commit.strip().decode('ascii')
else:

Loading…
Cancel
Save