Rust: fix qltest.sh for some versions of macOS

Turns out some version of macOS do not support the way `mktemp` was
being used. In any case it wasn't really necessary, see
https://github.com/github/codeql/pull/18918#discussion_r1979444850
(which I forgot to follow up on at the time after approval).
This commit is contained in:
Paolo Tranquilli
2025-03-13 16:54:27 +01:00
parent 4681f28f92
commit 8cc39af190

View File

@@ -4,19 +4,18 @@ set -eu
set -o pipefail set -o pipefail
export RUST_BACKTRACE=full export RUST_BACKTRACE=full
QLTEST_LOG="$CODEQL_EXTRACTOR_RUST_LOG_DIR"/qltest.log QLTEST_LOG="$CODEQL_EXTRACTOR_RUST_LOG_DIR/qltest.log"
mkdir -p "$CODEQL_EXTRACTOR_RUST_SCRATCH_DIR" QLTEST_COLORED_LOG="$CODEQL_EXTRACTOR_RUST_SCRATCH_DIR/qltest.log"
TMP_OUT="$(mktemp --tmpdir="$CODEQL_EXTRACTOR_RUST_SCRATCH_DIR" qltest-XXXXXX.log))" dirname "$QLTEST_LOG" "$QLTEST_COLORED_LOG" | xargs mkdir -p
trap 'rm -f "$TMP_OUT"' EXIT
# put full-color output on the side, but remove the color codes from the log file # put full-color output on the side, but remove the color codes from the log file
# also, print (colored) output only in case of failure # also, print (colored) output only in case of failure
if ! "$CODEQL_EXTRACTOR_RUST_ROOT/tools/$CODEQL_PLATFORM/extractor" \ if ! "$CODEQL_EXTRACTOR_RUST_ROOT/tools/$CODEQL_PLATFORM/extractor" \
--qltest \ --qltest \
--logging-verbosity=progress+ \ --logging-verbosity=progress+ \
2>&1 \ 2>&1 \
| tee "$TMP_OUT" \ | tee "$QLTEST_COLORED_LOG" \
| sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' \ | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' \
> "$QLTEST_LOG"; then > "$QLTEST_LOG"; then
cat "$TMP_OUT" cat "$QLTEST_COLORED_LOG"
exit 1 exit 1
fi fi