Expand description
Signal delivery and the signal exit-code convention.
Both runners stop processes the same way, so the signal vocabulary lives in one place instead of being duplicated per runner:
The model mirrors the JavaScript implementation:
- The requested signal is delivered to the child and its process group, so grandchildren spawned by a shell are stopped too. The group is skipped for a child that shares the caller’s terminal, which stays in the caller’s process group by design so that CTRL+C keeps reaching it.
- The child is given a grace period (
DEFAULT_KILL_GRACE_MS) to run its own signal handler and exit on its own terms. - If it is still alive when the grace period expires,
SIGKILLfollows, so a process that ignores the signal still terminates. - The reported exit code is the conventional
128 + signalvalue (signal_exit_code).
A grace period of zero collapses steps 1 to 3 into SIGKILL alone: any work
between the requested signal and the escalation is a window the child can be
scheduled in, so delivering it first would make “no grace” a race rather
than a guarantee. The exit code still reflects the signal that was asked
for.
Constants§
- DEFAULT_
KILL_ GRACE_ MS - Default grace period (in milliseconds) between the requested signal and the
forceful
SIGKILLescalation. - DEFAULT_
KILL_ SIGNAL - Default signal used to stop a process when no explicit signal is given.
Functions§
- signal_
exit_ code - The exit code reported for a process stopped with
signal, following the conventional128 + signalmapping used by POSIX shells. - signal_
number - Map a signal name to its numeric value.