> Under BSDI 2.0 (gcc 1.42 compiled), I run into the folowing:
>
> perl -le 'open(P,"cat /etc/passwd|");$x=<P>;close(P)||die("Fail: $?")'
>
> prints "Fail: 13". Why? Well, it would seem that, contrary to the
> docs, perl is doing a non-blocking wait on the process.
Happens on SunOS 4.1.4 and Ultrix 4.3 too, both with perl 4.036 and 5.001m.
(That is, I had to replace `cat /etc/passwd' with `yes foo' which
doesn't terminate that quickly:-)
Since it seems so well-established, maybe it should be called a doc
bug - and the function `wait FILEHANDLE' could be used to wait instead...
I suspect it would break and/or slow down a lot of programs to fix this
now. If you fix it, at least add something to avoid deadlock: Perl
waiting for the process, which waits for perl to drain the pipe so it
can write some more output.
Regards,
Hallvard
>
> perl -le 'open(P,"cat /etc/passwd|");$x=<P>;close(P)||die("Fail: $?")'
>
> prints "Fail: 13". Why? Well, it would seem that, contrary to the
> docs, perl is doing a non-blocking wait on the process.
Happens on SunOS 4.1.4 and Ultrix 4.3 too, both with perl 4.036 and 5.001m.
(That is, I had to replace `cat /etc/passwd' with `yes foo' which
doesn't terminate that quickly:-)
Since it seems so well-established, maybe it should be called a doc
bug - and the function `wait FILEHANDLE' could be used to wait instead...
I suspect it would break and/or slow down a lot of programs to fix this
now. If you fix it, at least add something to avoid deadlock: Perl
waiting for the process, which waits for perl to drain the pipe so it
can write some more output.
Regards,
Hallvard