|
9 | 9 | import extractor_version
|
10 | 10 |
|
11 | 11 |
|
12 |
| -def _check_call(command, extra_env=None): |
| 12 | +def _check_call(command, extra_env={}): |
13 | 13 | print('+ {}'.format(' '.join(command)), flush=True)
|
14 | 14 |
|
15 |
| - # only pass `env` argument if we need to pass in an updated environment |
16 |
| - kwargs = {} |
17 |
| - if extra_env: |
18 |
| - new_env = os.environ.copy() |
19 |
| - new_env.update(extra_env) |
20 |
| - kwargs = {"env": new_env} |
| 15 | + env = os.environ.copy() |
| 16 | + env.update(extra_env) |
| 17 | + subprocess.check_call(command, stdin=subprocess.DEVNULL, env=env) |
21 | 18 |
|
22 |
| - subprocess.check_call(command, stdin=subprocess.DEVNULL, **kwargs) |
23 | 19 |
|
24 |
| - |
25 |
| -def _check_output(command, extra_env=None): |
| 20 | +def _check_output(command, extra_env={}): |
26 | 21 | print('+ {}'.format(' '.join(command)), flush=True)
|
27 | 22 |
|
28 |
| - # only pass `env` argument if we need to pass in an updated environment |
29 |
| - kwargs = {} |
30 |
| - if extra_env: |
31 |
| - new_env = os.environ.copy() |
32 |
| - new_env.update(extra_env) |
33 |
| - kwargs = {"env": new_env} |
34 |
| - |
35 |
| - out = subprocess.check_output(command, stdin=subprocess.DEVNULL, **kwargs) |
| 23 | + env = os.environ.copy() |
| 24 | + env.update(extra_env) |
| 25 | + out = subprocess.check_output(command, stdin=subprocess.DEVNULL, env=env) |
36 | 26 | print(out, flush=True)
|
37 | 27 | sys.stderr.flush()
|
38 | 28 | return out
|
|
0 commit comments