Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: INT signal kills process run with expect, when $SIG{'INT'} is set

by ISAI student (Scribe)
on Feb 22, 2011 at 08:34 UTC ( #889537=note: print w/ replies, xml ) Need Help??


in reply to INT signal kills process run with expect, when $SIG{'INT'} is set

It's actually kills even w/o Expect. Code below is killed with ^c too:

require Expect; use strict; $SIG{'INT'}=sub {print "Al Bundy rules!\n";}; sleep 10000;
The prcess lasts until 1st ^c.


Comment on Re: INT signal kills process run with expect, when $SIG{'INT'} is set
Download Code
Re^2: INT signal kills process run with expect, when $SIG{'INT'} is set
by cdarke (Prior) on Feb 22, 2011 at 09:05 UTC
    On many platforms sleep will exit on any signal, including SIGINT. You need to place it in a loop. For example:
    use warnings; use strict; $SIG{'INT'}=sub {print "Clive Darke rules!\n";}; while (1) { sleep 10000; }
Re: INT signal kills process run with expect, when $SIG{'INT'} is set
by ikegami (Pope) on Feb 22, 2011 at 16:53 UTC

    It doesn't kill the process, handled signals interrupt sleep. If they didn't, the handler wouldn't get to run. See Re: fork() doesn't care about my sleep()? for how to make sleep uninterruptible.

    The OP didn't (visibly) use a sleep in the process that has a signal handler, so this isn't (likely to be) the OP's problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://889537]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (18)
As of 2015-07-07 14:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (89 votes), past polls