in reply to Timing out backquoted executions
You want an alarm, however with backticks this does leave the process hanging and there's no easy way to get its pid, but it is your child so you can do things to your process group to take it down, perhaps an END that sigkills the process group?
eval { local $SIG{ALRM} = sub { die "Alarma" }; alarm 10; `perl -e 'while(1) {};'`; alarm 0; }; if ($@ eq 'Alarma') { warn "alarm'd"; } elsif ($@) { die $@; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Timing out backquoted executions
by Anonymous Monk on Aug 02, 2007 at 20:10 UTC | |
by Joost (Canon) on Aug 02, 2007 at 20:19 UTC |