Skip to content

Commit cdb7275

Browse files
swissspidyclaude
andcommitted
Clean up the Gherkin runner's scratch file on interrupt
The temporary file holding the linter's STDERR was only removed on the normal path, so a Ctrl-C during a lint left it behind. Use the same trap the PHPStan runner already uses for its own scratch directory. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GjJi6F76YZBt7cRrvXS6s6
1 parent ccd58c5 commit cdb7275

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎bin/run-gherkin-lint-tests‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ then
7272
# It writes the report to STDERR, so strip the escape sequences from that
7373
# stream while leaving STDOUT and the exit code alone.
7474
STDERR_FILE=$( mktemp )
75+
trap 'rm -f "${STDERR_FILE}"' EXIT HUP INT TERM
7576

7677
run_linter "$@" 2> "${STDERR_FILE}"
7778
STATUS=$?
@@ -82,8 +83,6 @@ then
8283
sed "s/${ESC}\[[0-9;]*m//g" "${STDERR_FILE}" >&2
8384
fi
8485

85-
rm -f "${STDERR_FILE}"
86-
8786
exit ${STATUS};
8887
fi
8988

0 commit comments

Comments
 (0)