diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | doc/coreutils.texi | 5 | ||||
-rw-r--r-- | src/timeout.c | 12 |
3 files changed, 13 insertions, 6 deletions
@@ -92,6 +92,8 @@ GNU coreutils NEWS -*- outline -*- tee does not treat the file operand '-' as meaning standard output any longer, for better conformance to POSIX. This feature was added in coreutils-5.3.0. + timeout --foreground no longer sends SIGCONT to the monitored process, + which was seen to cause intermittent issues with GDB for example. ** Improvements diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 4ae06c30b..a7362b30c 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -16594,7 +16594,10 @@ from the terminal (like Ctrl-C for example) @end enumerate Note in this mode of operation, any children of @var{command} -will not be timed out. +will not be timed out. Also SIGCONT will not be sent to @var{command}, +as it's generally not needed with foreground processes, and can +cause intermittent signal delivery issues with programs that are monitors +themselves (like GDB for example). @item -k @var{duration} @itemx --kill-after=@var{duration} diff --git a/src/timeout.c b/src/timeout.c index 19c07653a..98378f6f5 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -203,15 +203,17 @@ cleanup (int sig) in case it has itself become group leader, or is not running in a separate group. */ send_sig (monitored_pid, sig); + /* The normal case is the job has remained in our newly created process group, so send to all processes in that. */ if (!foreground) - send_sig (0, sig); - if (sig != SIGKILL && sig != SIGCONT) { - send_sig (monitored_pid, SIGCONT); - if (!foreground) - send_sig (0, SIGCONT); + send_sig (0, sig); + if (sig != SIGKILL && sig != SIGCONT) + { + send_sig (monitored_pid, SIGCONT); + send_sig (0, SIGCONT); + } } } else /* we're the child or the child is not exec'd yet. */ |