Skip to content

Commit c979d03

Browse files
Only call git on a git repository
1 parent 4307484 commit c979d03

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tools/install.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@
3737

3838

3939
def add_revision_file(target):
40-
# text=True would be better than encoding here, but it's only supported in 3.7+
41-
git_hash = subprocess.check_output(['git', 'rev-parse', 'HEAD'], encoding='utf-8').strip()
42-
with open(os.path.join(target, 'emscripten-revision.txt'), 'w') as f:
43-
f.write(git_hash + '\n')
40+
if os.path.isdir('.git'):
41+
# text=True would be better than encoding here, but it's only supported in 3.7+
42+
git_hash = subprocess.check_output(['git', 'rev-parse', 'HEAD'], encoding='utf-8').strip()
43+
with open(os.path.join(target, 'emscripten-revision.txt'), 'w') as f:
44+
f.write(git_hash + '\n')
4445

4546

4647
def copy_emscripten(target):

0 commit comments

Comments
 (0)