mirror of
https://github.com/reactos/ninja.git
synced 2024-11-26 21:20:23 +00:00
Run output test in temporary directory
This commit is contained in:
parent
94c66fd01a
commit
a67718de4e
@ -18,12 +18,15 @@ if 'NINJA_STATUS' in default_env:
|
||||
if 'CLICOLOR_FORCE' in default_env:
|
||||
del default_env['CLICOLOR_FORCE']
|
||||
default_env['TERM'] = ''
|
||||
NINJA_PATH = os.path.abspath('./ninja')
|
||||
|
||||
def run(build_ninja, flags='', pipe=False, env=default_env):
|
||||
with tempfile.NamedTemporaryFile('w') as f:
|
||||
f.write(build_ninja)
|
||||
f.flush()
|
||||
ninja_cmd = './ninja {} -f {}'.format(flags, f.name)
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
os.chdir(d)
|
||||
with open('build.ninja', 'w') as f:
|
||||
f.write(build_ninja)
|
||||
f.flush()
|
||||
ninja_cmd = '{} {}'.format(NINJA_PATH, flags)
|
||||
try:
|
||||
if pipe:
|
||||
output = subprocess.check_output([ninja_cmd], shell=True, env=env)
|
||||
|
Loading…
Reference in New Issue
Block a user