diff options
author | Jan Niklas Hasse <jhasse@bixense.com> | 2019-12-23 13:08:59 (GMT) |
---|---|---|
committer | Jan Niklas Hasse <jhasse@bixense.com> | 2019-12-23 13:08:59 (GMT) |
commit | a67718de4e5e4f78b6f66c6a3ecd0432941c7df3 (patch) | |
tree | 45625b30e6ed3e9cacc166ea4fa19519735516cb /misc | |
parent | 94c66fd01a8da67a9e169135780d8967eba69048 (diff) | |
download | Ninja-a67718de4e5e4f78b6f66c6a3ecd0432941c7df3.zip Ninja-a67718de4e5e4f78b6f66c6a3ecd0432941c7df3.tar.gz Ninja-a67718de4e5e4f78b6f66c6a3ecd0432941c7df3.tar.bz2 |
Run output test in temporary directory
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/output_test.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/misc/output_test.py b/misc/output_test.py index fb73d72..966417d 100755 --- a/misc/output_test.py +++ b/misc/output_test.py @@ -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) |