Operating System - Linux
1753734 Members
4386 Online
108799 Solutions
New Discussion юеВ

timeout for system commands - perl

 
SOLVED
Go to solution
itai weisman
Super Advisor

timeout for system commands - perl

Hi,
on perl script,
does anyone know a way to fail a system function call, if it takes too much time,
(maybe by using another function or module)
f.e.
if I'm using
system("command1");
and command1 takes too much time (or even hangs)
the whole script hangs....
any idea?



3 REPLIES 3
Peter Godron
Honored Contributor
Solution

Re: timeout for system commands - perl

Hi,
not sure if this is what you are after:
http://perldoc.perl.org/functions/alarm.html

Can you not timeout the call, once your expected execution time has elapsed?
Joel Girot
Trusted Contributor

Re: timeout for system commands - perl

itai weisman
Super Advisor

Re: timeout for system commands - perl

10x