Skip to content

Commit

Permalink
fix: Always use absolute path to temp folders (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
sassdavid authored Jul 25, 2024
1 parent b88a856 commit a058372
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions package.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ def tempdir(dir=None):
"""Creates a temporary directory and then deletes it afterwards."""
prefix = "terraform-aws-lambda-"
path = tempfile.mkdtemp(prefix=prefix, dir=dir)
cmd_log.info("mktemp -d %sXXXXXXXX # %s", prefix, shlex.quote(path))
abs_path = os.path.abspath(path)
cmd_log.info("mktemp -d %sXXXXXXXX # %s", prefix, shlex.quote(abs_path))
try:
yield path
yield abs_path
finally:
shutil.rmtree(path)
shutil.rmtree(abs_path)


def list_files(top_path, log=None):
Expand Down

0 comments on commit a058372

Please sign in to comment.