-
Notifications
You must be signed in to change notification settings - Fork 556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perl hangs when two files are redirected into a pipe #953
Comments
From summer@OS2.ami.com.auI took some code 'man perlfunc' and modified it to read thus: open(STDOUT, "| cat >foo.out") || die "Can't redirect stdout"; # JCS select(STDERR); $| = 1; # make unbuffered print STDOUT "stdout 1\n"; # this works for close(STDOUT); open(STDOUT, ">&OLDOUT"); print STDOUT "stdout 2\n"; The only line I changed is labeled JCS. This hangs (waits indefinitely), apparently at one or other of the closes I'm running perl on RHL 5.x: Characteristics of this binary (from libperl): It also happens on RHL 6.1 Characteristics of this binary (from libperl): -- |
From @tamiasOn Wed, Dec 15, 1999 at 09:09:45PM +0800, John Summerfield wrote:
I see the same behavior here in 5.005_03. Stepping through with the Ronald |
From [Unknown Contact. See original ticket]Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote
Yes - that's because Perl doesn't "know" that STDERR is thr result of a The prpoblem is a more general one, and will hit if the file descriptor % perl -w ... then silence. And of course, there's other twists if you close the filehandle in the Seems to me like a fundamental restriction in the way piped opens work, Mike Guy |
From [Unknown Contact. See original ticket]
For more than a million seconds? Eleven and a half days?
That would break a lot of documentation (Camel book for one), and it seems Lots of people are going to rely on existing printed material for years to If there's way, pls find it. -- |
From @gsarOn Thu, 16 Dec 1999 18:25:15 GMT, "M.J.T. Guy" wrote:
I don't think waiting in close(STDERR) is the problem. It's the close(STOUT)
As John noticed correctly, that doesn't hang; it merely sleeps a great long open(A, "| cat >foo.out") or die; close(A); # hangs... The problem really originates in the old fclose/pclose duplicity. This #include <stdio.h> Chalk up another reason to rewrite stdio. Sarathy |
Migrated from rt.perl.org#1900 (status was 'resolved')
Searchable as RT1900$
The text was updated successfully, but these errors were encountered: