Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: killing a program called with system() if it takes too long?

by xdg (Monsignor)
on Dec 18, 2008 at 18:19 UTC ( [id://731342]=note: print w/replies, xml ) Need Help??


in reply to killing a program called with system() if it takes too long?

...unless i manually kill (Ctrl+Alt+Del) ...

Are you on Windows? If so, run your external program with Win32::Job, which has timeout support built in.

use Win32::Job; my $job = Win32::Job->new; # Run 'perl Makefile.PL' for 10 seconds $job->spawn($Config{perlpath}, "perl Makefile.PL"); $job->run(10);

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-03-28 20:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found