W
Weirong Zhu
A beginner question!
I have a piece of code
#!/usr/bin/perl -w
print "$$ \n";
eval{
local $SIG{ALRM} = sub { die "Timeout Alarm" };
alarm 5;
$rt = system("/home/user/tmp/long");
alarm 0;
};
if ($@ = ~/Timeout Alarm/) {
print "**** Time Out\n";
}
blahblah......
----------------------------
when it finishes, the child process invoked by system() does not
terminated. But I want to kill it when it's timed out. How to do this?
The reason that I want to use the system(), because I want to get the
return value when it's not timed out.
I have a piece of code
#!/usr/bin/perl -w
print "$$ \n";
eval{
local $SIG{ALRM} = sub { die "Timeout Alarm" };
alarm 5;
$rt = system("/home/user/tmp/long");
alarm 0;
};
if ($@ = ~/Timeout Alarm/) {
print "**** Time Out\n";
}
blahblah......
----------------------------
when it finishes, the child process invoked by system() does not
terminated. But I want to kill it when it's timed out. How to do this?
The reason that I want to use the system(), because I want to get the
return value when it's not timed out.