in reply to Re: IPC::Open3 woes
in thread IPC::Open3 woes
I am hopeing that somebody can add some clarity to this old thread. Can somebody tell me why the following coded hangs if the line which defines the @outlines array is commented out?
I have used open3 in other places w/o reading the the child's output and the process didn't hang. I expect it is because in that case the command didn't have output.
I understand how some of the other example programs in this thread prevent locking while read from open3's handles but it seems strange that this would lock when I am not reading from them and just calling waitpid as soon as possible.
Also, should I explicitly close $wtr, $rtr, and $err?
... my($wtr,$rdr); my $err = gensym; ### $logcmd is a command that returns approx. 460 lines. my $pid = open3($wtr, $rdr, $err, "$logcmd"); my @outlines = <$rdr>; ### if this line is commented out we hang on w +aitpid waitpid( $pid, 0 ); ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: IPC::Open3 woes
by ikegami (Patriarch) on Apr 21, 2010 at 23:36 UTC | |
|
Re^3: IPC::Open3 woes
by Anonymous Monk on Apr 21, 2010 at 23:04 UTC |