Skip to content

Commit

Permalink
Use TemporaryDirectory for simplicity.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 30, 2022
1 parent 48cc9e6 commit ebd0910
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pip_run/ephemeral.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import contextlib
import tempfile
import shutil
import pathlib


@contextlib.contextmanager
def context(args):
target = pathlib.Path(tempfile.mkdtemp(prefix='pip-run-'))
try:
yield target
finally:
shutil.rmtree(target)
with tempfile.TemporaryDirectory(prefix='pip-run-') as td:
yield pathlib.Path(td)

0 comments on commit ebd0910

Please sign in to comment.