Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
eltoder committed Apr 24, 2024
1 parent faaa288 commit 7899692
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion green/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,15 @@ def main(argv: Sequence[str] | None = None, testing: bool = False) -> int:
temp_dir_for_tests = tempfile.mkdtemp()
atexit.register(lambda: shutil.rmtree(temp_dir_for_tests, ignore_errors=True))
os.environ["TMPDIR"] = temp_dir_for_tests
prev_tempdir = tempfile.tempdir
tempfile.tempdir = temp_dir_for_tests
return _main(argv, testing)
try:
return _main(argv, testing)
finally:
del os.environ["TMPDIR"]
tempfile.tempdir = prev_tempdir
else:
return _main(argv, testing)


if __name__ == "__main__": # pragma: no cover
Expand Down

0 comments on commit 7899692

Please sign in to comment.