Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 44ed374

Browse files
committed
Make output_test.py independent of the environment
1 parent 0858f2e commit 44ed374

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

misc/output_test.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,27 @@
55
In order to simulate a smart terminal it uses the 'script' command.
66
"""
77

8+
import os
89
import subprocess
910
import sys
1011
import tempfile
1112
import unittest
1213

1314
def run(build_ninja, flags='', pipe=False):
15+
env = dict(os.environ)
16+
if 'NINJA_STATUS' in env:
17+
del env['NINJA_STATUS']
18+
env['TERM'] = ''
1419
with tempfile.NamedTemporaryFile('w') as f:
1520
f.write(build_ninja)
1621
f.flush()
1722
ninja_cmd = './ninja {} -f {}'.format(flags, f.name)
1823
try:
1924
if pipe:
20-
output = subprocess.check_output([ninja_cmd], shell=True)
25+
output = subprocess.check_output([ninja_cmd], shell=True, env=env)
2126
else:
22-
output = subprocess.check_output(['script', '-qfec', ninja_cmd, '/dev/null'])
27+
output = subprocess.check_output(['script', '-qfec', ninja_cmd, '/dev/null'],
28+
env=env)
2329
except subprocess.CalledProcessError as err:
2430
sys.stdout.buffer.write(err.output)
2531
raise err

0 commit comments

Comments
 (0)