$pid = open3(\*CHLDIN, \*CHLDOUT, \*CHLDERR, @$cmd); close(CHLDIN);
# timeout handling { local $@ = ""; eval { local $SIG{ALRM} = sub { die("alarm\n") }; # "\n" required alarm(3); # potentially long operation chomp($input = <STDIN>); alarm(0); 1; } or do { die($@) unless $@ eq "alarm\n"; # timed out warn("No answer for three seconds.\n"); $input = ""; } }
In reply to Re: open3 hangs
by repellent
in thread open3 hangs
by stephan_a
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |