1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-21 03:12:48 +02:00

timeout: prioritize "timed out" exit status

* src/timeout.c (cleanup): Reset the default exit status
to EXIT_TIMEDOUT, if we have in fact received an ALARM.
Otherwise we would exit with status EXIT_CANCELED if
there was an issue writing --verbose output for example.
This also ensures a consistent exit status with ASAN enabled,
as with ASAN stderr is not explicitly closed by gnulib's
close_stdout handler.
This commit is contained in:
Pádraig Brady
2025-12-02 17:15:06 +00:00
parent 2d07c26d95
commit 86061ddbbd
2 changed files with 7 additions and 1 deletions

View File

@@ -75,7 +75,7 @@ done
# Specifically here we're testing that SIGPIPE is handled.
# I.e., that we're not killed by the SIGPIPE (and leave the sleep running).
# timeout would exit with 141 usually if SIGPIPE wasn't being handled.
echo 125 > timeout.exp || framework_failure_
echo 124 > timeout.exp || framework_failure_
{ timeout -v .1 sleep 10 2>&1; echo $? >timeout.status; } | :
compare timeout.exp timeout.status || fail=1
# Ensure we don't catch/propagate ignored signals