Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^7: Print inside SIGNALS

by ikegami (Patriarch)
on Jul 17, 2018 at 16:18 UTC ( [id://1218669]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Print inside SIGNALS
in thread Print inside SIGNALS

No, "it didn't work" for you because you killed the program before the signal handler was called.

Replies are listed 'Best First'.
Re^8: Print inside SIGNALS
by haukex (Archbishop) on Jul 17, 2018 at 18:14 UTC
    No, "it didn't work" for you because you killed the program before the signal handler was called.

    Have you tried the one-liners yourself? (I ran them on Ubuntu Linux, in case that makes a difference.)

    Are you saying you are observing different behavior than I am? If so, what is that behavior?

    If you're saying it's not a buffering issue, what do you think is causing the different behavior of the first two of my one-liners above?

      Let me be clear: Don't kill the program (e.g. by sending SIGINT to the program) and then complain that the rest of the program (e.g. the signal handler) doesn't run.

        Don't kill the program (e.g. by sending SIGINT to the program) and then complain that the rest of the program (e.g. the signal handler) doesn't run.

        I didn't.

        $ perl -e 'sleep 10;print"World\n"' | perl -e '$x=time; $SIG{ALRM}=sub{print"Hello ";$y=time}; alarm 2; $z=<>; print $z,$y-$x," ",time-$x,"\n"' Hello World 2 10

        On my system, all of the above output does not happen until after 10 seconds. See above.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-25 14:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found