opnsense-src/bin/timeout
Aaron LI c362781c8d timeout(1): Document the reaper implementation and behaivor
If timeout(1) runs with the --foreground option, it becomes the reaper
of the command and its descendants and will wait for all of them to
terminate.  This behavior is different from the old FreeBSD version and
GNU version.

For example, if there is a descendant running in the background, like:
$ timeout -s INT 2 sh -c 'sleep 4 & sleep 5'
when timeout(1) sends the SIGINT to all descendants, the child 'sh'
process and the foreground 'sleep 5' process will immediately terminate,
but the background 'sleep 4' will be reparented to the timeout(1)
itself.  Because a background process ignores SIGINT and SIGQUIT,
the whole command completes until the background 'sleep 4' finishes.

In comparison, the old FreeBSD version and GNU version will just
terminate itself, letting the background 'sleep 4' process be reparented
to an upper reaper like init.

The POSIX.1-2024 standard doesn't specify the required behavior in such
cases, so I decided to keep the current implementation.  Nonetheless,
the updated timeout(1) has changed a lot in order to conform to the
standard.

Obtained-from: DragonFly BSD
2025-04-16 21:45:38 +02:00
..
tests timeout(1): adapt the preserve_status test to the new behaviour 2025-04-16 21:45:38 +02:00
Makefile Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
timeout.1 timeout(1): Document the reaper implementation and behaivor 2025-04-16 21:45:38 +02:00
timeout.c timeout(1): Kill self with the same signal that terminated the child 2025-04-16 21:45:38 +02:00