T
tpurl
There's a process that I open in a script using the following code:
my $cmd = "myproc -l |";
open(MYPROC, $cmd) or croak("Error $?: Couldn't execute $cmd: $!");
my @lines = <MYPROC>;
close(MYPROC);
This code works pretty well *unless* the process hangs, which is does
occasionally. If myproc hangs, then my script hangs.
Is there a way to open a process and raise an error if it runs for more
than, say 15 seconds?
Thanks in advance for any help!
Tom Purl
my $cmd = "myproc -l |";
open(MYPROC, $cmd) or croak("Error $?: Couldn't execute $cmd: $!");
my @lines = <MYPROC>;
close(MYPROC);
This code works pretty well *unless* the process hangs, which is does
occasionally. If myproc hangs, then my script hangs.
Is there a way to open a process and raise an error if it runs for more
than, say 15 seconds?
Thanks in advance for any help!
Tom Purl