From 1df0979da6bbe5de8549693d12cb3e547bc6d94a Mon Sep 17 00:00:00 2001 From: Christian Heusel Date: Sat, 15 Jun 2024 14:23:21 +0200 Subject: fix(common): guard the WORKDIR environment var This avoids the unwanted removal of the folder if someone has already pre-defined the variable. Fixes #219 Suggested-by: Levente Polyak Signed-off-by: Christian Heusel --- src/lib/common.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/lib/common.sh b/src/lib/common.sh index b087bb1..5416eaf 100644 --- a/src/lib/common.sh +++ b/src/lib/common.sh @@ -120,6 +120,8 @@ print_workdir_error() { } _setup_workdir=false +# Ensure that there is no outside value for WORKDIR leaking in +unset WORKDIR setup_workdir() { [[ -z ${WORKDIR:-} ]] && WORKDIR=$(mktemp -d --tmpdir "${0##*/}.XXXXXXXXXX") _setup_workdir=true -- cgit v1.2.3-70-g09d2