Fix git not found error on Windows when running gclient (#728)

It happens if `git` is not installed as a standard alone application, but as a shell command.

Fixes #724.
This commit is contained in:
Abhay Sundaram 2020-03-13 21:52:12 +05:30 committed by GitHub
parent c576814d30
commit 28537034e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -32,8 +32,8 @@ if 'check_output' not in dir(subprocess):
if __name__ == '__main__':
try:
version_tag = subprocess.check_output(
['git', 'tag', '--points-at', 'HEAD'],
stderr=subprocess.STDOUT).rstrip()
'git tag --points-at HEAD',
stderr=subprocess.STDOUT, shell=True).rstrip()
except subprocess.CalledProcessError as e:
# git tag --points-at is not supported in old versions of git. Just ignore
# version_tag in this case.
@ -41,8 +41,8 @@ if __name__ == '__main__':
try:
version_hash = subprocess.check_output(
['git', 'rev-parse', '--short', 'HEAD'],
stderr=subprocess.STDOUT).rstrip()
'git rev-parse --short HEAD',
stderr=subprocess.STDOUT, shell=True).rstrip()
except subprocess.CalledProcessError as e:
version_hash = 'unknown-version'