Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^3: trying to get timeout to work

by halfcountplus (Hermit)
on Apr 11, 2012 at 14:38 UTC ( #964550=note: print w/replies, xml ) Need Help??

in reply to Re^2: trying to get timeout to work
in thread trying to get timeout to work

Yes, but it will happen in the requested 3 seconds. If you want a non-fatal handler:

local $SIG{ALRM} = sub { print STDERR "hey\n" };
Ie, there is a difference in behaviour between that and set_sig_handler(). Whoops, no there isn't, but adding STDERR reporting does shed some light on when the alarm fires...

Replies are listed 'Best First'.
Re^4: trying to get timeout to work
by Eliya (Vicar) on Apr 11, 2012 at 14:46 UTC

    Have you tried it?   AFAICT, this still doesn't do what the OP wants.

    Instead of the script getting killed, when the alarm fires, it now prints "hey" to STDERR, and then still goes to wait 60 seconds until the suprocess completes by itself.

      Have you tried it?

      Yes. But I didn't add a print into the OP's handler, or a die into mine, which is why they seemed different due to the wait behaviour you describe. ;)

      All apologies, will edit.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://964550]
[Yaerox]: I feel like i'm not seeing the forest for the trees. Can someone give me a hint how to research converting all kinds of files into ansi? If origin file is utf8 convert to ansi, is origin file is ansi then skip file.
[1nickt]: Yaerox probably best to whip up an SSCCE demonstrating the failure in what you have now and post to SoPW as a question.

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2017-03-28 13:11 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (331 votes). Check out past polls.