Skip to content

Commit 254b21f

Browse files
committed
fix: handle TMPDIR absence gracefully during cleanup
- Prevent errors during cleanup if TMPDIR is unset or not a directory Signed-off-by: appleboy <[email protected]>
1 parent 8e6bab8 commit 254b21f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

install.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ set -euo pipefail
55
# Create temp directory for downloads.
66
TMPDIR="$(mktemp -d)"
77
function cleanup() {
8-
rm -rf "${TMPDIR}"
8+
if [ -n "${TMPDIR:-}" ] && [ -d "$TMPDIR" ]; then
9+
rm -rf "$TMPDIR"
10+
fi
911
}
1012
trap cleanup EXIT INT TERM
1113

0 commit comments

Comments
 (0)