GNU bug report logs -
#46403
SIGINT ignored when using system*
Previous Next
Full log
Message #8 received at 46403 <at> debbugs.gnu.org (full text, mbox):
Hi!
Ricardo Wurmus <rekado <at> elephly.net> skribis:
> I execute commands in a loop and wish to be able to interrupt the loop
> with SIGINT. Here’s the first attempt:
>
> guile -c \
> '(for-each (lambda (n)
> (display n)
> (system* "sleep" "3"))
> (list 1 2 3 4))'
>
> At no point will this program be interrupted by SIGINT. Strace reveals
> that SIGINT is in fact received and the sleep is interrupted, but the
> wait is restarted immediately afterward.
‘system*’ explicitly ignores SIGINT:
--8<---------------cut here---------------start------------->8---
/* Make sure the child can't kill us (as per normal system call). */
scm_dynwind_sigaction (SIGINT,
scm_from_uintptr_t ((uintptr_t) SIG_IGN),
SCM_UNDEFINED);
--8<---------------cut here---------------end--------------->8---
Indeed, system(3) says:
During execution of the command, SIGCHLD will be blocked, and SIGINT
and SIGQUIT will be ignored, in the process that calls system().
(These signals will be handled according to their defaults inside the
child process that executes command.)
(I did some archaeology and found it has always been this way since Rob
introduced ‘system*’ in 0db17ef9abd59da51ebc30d90fb2dc482b02a4a1.)
> Is this by design?
I think so!
Ludo’.
This bug report was last modified 4 years and 44 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.