From a058372431c552a0cb740a76beffe77285edeb91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sass=20D=C3=A1vid?= <51000212+sassdavid@users.noreply.github.com> Date: Thu, 25 Jul 2024 11:36:25 +0200 Subject: [PATCH] fix: Always use absolute path to temp folders (#599) --- package.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.py b/package.py index 1552e8e2..ded4056e 100644 --- a/package.py +++ b/package.py @@ -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):