summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2015-05-13 13:41:42 +0100
committerPádraig Brady <P@draigBrady.com>2015-05-13 13:48:56 +0100
commit45b8fe430dced8c489cb64491b8716cffeeca8c3 (patch)
tree7e5858933105e4f797ce545c70aaf531ed02f906 /src
parent703747f892d3ec4713b97d4bff770a80122cd1ef (diff)
downloadcoreutils-45b8fe430dced8c489cb64491b8716cffeeca8c3.tar.xz
timeout: with --foreground don't send SIGCONT
* src/timeout.c (cleanup): Don't send SIGCONT to the monitored program when --foreground is specified, as it's generally not needed for foreground programs, and can cause intermittent signal delivery issues with monitors like GDB for example. * doc/coreutils.texi (timeout invocation): Mention that SIGCONT is not sent with --foreground. * NEWS: Mention the behavior change.
Diffstat (limited to 'src')
-rw-r--r--src/timeout.c12
1 files changed, 7 insertions, 5 deletions
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. */