Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

test: keep cleanup traps off the current folder when mktemp fails

raymondchins71958c599ad2
diff --git a/dylib/tests/gamedrivecheck.sh b/dylib/tests/gamedrivecheck.sh
index e72b94b..42a1c43 100644
--- a/dylib/tests/gamedrivecheck.sh
+++ b/dylib/tests/gamedrivecheck.sh
@@ -9,7 +9,8 @@ body=$(sed -n '/^game_drive_record() {/,/^}/p;/^record_game_drive() {/,/^}/p;/^r
body='without_lock_fds() { printf "%s\n" "${1##*/} $2" >> "$restarts"; }
'"$body"
-work=$(cd "$(mktemp -d)" && pwd -P)
+# a failed mktemp must not leave work at the current folder, which the trap deletes
+work=$(mktemp -d) && work=$(cd "$work" && pwd -P) || exit 1
trap 'rm -rf "$work"' EXIT
fails=0
diff --git a/scripts/tests/cicheck.sh b/scripts/tests/cicheck.sh
index 7271790..b3fa005 100644
--- a/scripts/tests/cicheck.sh
+++ b/scripts/tests/cicheck.sh
@@ -9,7 +9,7 @@
# shellcheck disable=SC2016 # the workflow lines checked below contain literal ${{ }} and $VAR
set -u
root=$(cd "$(dirname "$0")/../.." && pwd)
-work=$(mktemp -d)
+work=$(mktemp -d) || exit 1
trap 'rm -rf "$work"' EXIT
passed=0