in reply to Re: waitpid on Win32 ... wait forever
in thread waitpid on Win32 ... wait forever

Not sufficient. That won't help if the child blocks on printing STDERR, since the parent is blocked reading from the child's STDOUT.
use warnings; use strict; use Symbol qw(gensym); use IPC::Open3; my $out = gensym(); my $err = gensym(); my $cmd = 'dir 1>&2'; my $pid = open3(undef, $out, $err, $cmd); 1 while <$out>; 1 while <$err>; waitpid $pid, 0;

Replies are listed 'Best First'.
Re^3: waitpid on Win32 ... wait forever
by BrowserUk (Patriarch) on May 08, 2009 at 15:52 UTC

    You're right. You'd have to doing something like:

    my $t1 = async{ 1 while <$out> }; my $t2 = async{ 1 while <$err> }; $_->join for $t1, $t2; ...

    However, if your redirecting stdout to stderr, is there any point in reading stdout? And if you're going to discard the output without looking at it, why not just dump the whole lot to nul and have done with it?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      However, if your redirecting stdout to stderr,

      It was the mininal change required to send a known-sufficient amount of data to STDERR. Since open3 is used, input from both STDOUT and STDERR is probably expected in the actual situation where this is used.