local $SIG {ALRM} = sub {die "alarm"}; my $fh; eval { alarm (2); open $fh, "-|", "$vmdiscover ..." or die "Couldn't open $vmdiscove +r: $!"; while (<$fh>) {}; alarm (0); }; if ($@ && $@ =~ /^alarm/) { print "Command has timed out"; } elsif ($@) { print "$@\n"; } close $fh;
In reply to Re: Kill a command launched within script
by lostjimmy
in thread Kill a command launched within script
by ceweldon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |