Skip to content

Commit

Permalink
Prefer cwd argument to run_process over chdir. NFC. (#8556)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 committed May 7, 2019
1 parent b5586dc commit f64d84e
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions emcc.py
Expand Up @@ -455,15 +455,10 @@ def run(args):
return 0

if '--version' in args:
revision = '(unknown revision)'
here = os.getcwd()
os.chdir(shared.path_from_root())
try:
revision = run_process(['git', 'show'], stdout=PIPE, stderr=PIPE).stdout.split('\n')[0]
revision = run_process(['git', 'show'], stdout=PIPE, stderr=PIPE, cwd=shared.path_from_root()).stdout.splitlines()[0]
except:
pass
finally:
os.chdir(here)
revision = '(unknown revision)'
print('''emcc (Emscripten gcc/clang-like replacement) %s (%s)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
Expand Down Expand Up @@ -501,7 +496,7 @@ def run(args):
with misc_temp_files.get_file(suffix='.o') as temp_target:
input_file = 'hello_world.c'
err = run_process([shared.PYTHON, sys.argv[0]] + args + [shared.path_from_root('tests', input_file), '-c', '-o', temp_target], stderr=PIPE, env=debug_env).stderr
lines = [x for x in err.split('\n') if shared.CLANG_CC in x and input_file in x]
lines = [x for x in err.splitlines() if shared.CLANG_CC in x and input_file in x]
line = re.search('running: (.*)', lines[0]).group(1)
parts = shlex.split(line.replace('\\', '\\\\'))
parts = [x for x in parts if x != '-c' and x != '-o' and input_file not in x and temp_target not in x and '-emit-llvm' not in x]
Expand Down

0 comments on commit f64d84e

Please sign in to comment.