tests: timeout: fix false failure with older bash

This was seen on Centos 7 at least with bash 4.2.46.

* tests/timeout/timeout.sh: Ensure the shell doesn't incorrectly
optimize itself away when there are traps in place.
Reported by Bruno Haible.
This commit is contained in:
Pádraig Brady committed 2026-11-10 17:57:23 +00:00
1 parent 9aeb2eeb0f
commit c0146c7c60
1 file changed
+1
+1
View File
@@ -116,6 +116,7 @@ timeout -v .1 $SHELL -c '
exec 2>/dev/null # ensure no "Terminated" message blocks the trap
trap "echo 1 >term.seen" TERM
yes # Fill the pipe
: # Prevent shell exec optimization from discarding traps
' 2>&1 |
{ retry_delay_ file_seen .1 6 || touch term.missed; }
test -e term.missed && fail=1