[rt.cpan.org #102709] Unable to handle SIG interrupts
[email protected] ("Dmytro Zagashev via RT")
| Newsgroups | perl.par |
|---|---|
| Message-ID | <[email protected]> |
Wed Jul 08 00:57:23 2015: Request 102709 was acted upon.
Transaction: Correspondence added by ZDM
Queue: PAR-Packer
Subject: Unable to handle SIG interrupts
Broken in: (no value)
Severity: (no value)
Owner: Nobody
Requestors: [email protected]
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=102709 >
On Mon Jul 06 05:35:18 2015, RSCHUPP wrote:
> On 2015-07-06 01:18:54, ZDM wrote:
> > Do you see the patch code?
>
> Yes. Please use a unified diff next time.
>
> > 1. It is only for windows.
>
> This restriction isn't in your patch (or I can't tell from your patch
> because of
> missing context, see above).
>
> > 2. It solves the problem completely. It prevent parent process to
> > exit
> > by SIGINT. When CTRL+C pressed - windows send SIGINT to process
> > group.
>
> Can you cite some reference for this, preferably from MSDN.
>
> Also, why do you re-arm the signal handler - no modern system should
> need that,
> you should use sigaction anyway.
>
> Cheers, Roderich
Here is the more correct solution and simple:
# include <signal.h>
signal(SIGINT, SIG_IGN);
1. Previously signal was re-armed in handler, because signal call drop handler to the default. This is not needed if we use SIG_IGN;
2. sigaction is too complex and not needed if we just want to ignore signal;
3. About CTRL+C under windows:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682541%28v=vs.85%29.aspx
By default, these signals are passed to all console processes that are attached to the console. (Detached processes are not affected.)