In article <[EMAIL PROTECTED]>,
        Steve Hay <[EMAIL PROTECTED]> writes:
> Adding some debug, I find that $sel->can_read() is returning an empty 
> list.  If I change
> 
>     while (my @ready = $sel->can_read) {
>         foreach my $fh (@ready) { # loop through buffered handles
>             ...
>         }
>     }
> 
> to
> 
>     foreach my $fh ($outfh, $errfh) {
>         ...
>     }
> 
> then the output is now as expected.
> 
> Presumably IO::Select->can_read() doesn't work on Win32 because it uses 
> a 4-arg select(), which is only implemented for sockets on Win32.  Is 
> the above change safe, or did we need to call can_read() for some 
> reason?  Would the proposed "selectable pipes" change have any impact on 
> this?
> 
The case where the above type of change is dangerous is when the source 
tries to write more than can be buffered in the communication channel to 
err_fh and only then bothers to write to $out_fh. In that case you will
deadlock. the source will wait until enough gets drained from err_fh so it
can write again, and you will wait on $out_fh, which hasn't gotten anything
yet and now never will.

So whether that is relevant for your case depends on what you're running
(how it uses its output channels).

Reply via email to