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
IO::Pipe relies on STDIN and STDOUT #7872
Comments
From zefram@fysh.orgCreated by zefram@fysh.orgThe ->writer and ->reader methods on IO::Pipe rely on STDIN and STDOUT $ echo foo | perl -MIO::Pipe -we '*STDIN = *STDERR; $p = IO::Pipe->new->writer("cat"); $p->printflush("bar\n"); sleep 1' I ran into this problem in an Apache mod_perl handler, which runs in local *STDIN = IO::Handle->new_from_fd(0, "r"); Presumably IO::Pipe could do something akin to this internally, to ensure Perl Info
|
From schubiger@cpan.orgOn 12 Apr, Zefram wrote: : The ->writer and ->reader methods on IO::Pipe rely on STDIN and STDOUT Inline Patch--- lib/IO/Pipe.pm Sun Apr 4 15:32:35 2004
+++ lib/IO/Pipe.pm Wed Apr 13 05:38:32 2005
@@ -51,6 +51,8 @@
}
elsif(defined $pid) { # Child or spawn
my $fh;
+ local *STDIN = IO::Handle->new_from_fd(0, 'r') unless fileno(STDIN) == 0;
+ local *STDOUT = IO::Handle->new_from_fd(1, 'w') unless fileno(STDOUT) == 1;
my $io = $rw ? \*STDIN : \*STDOUT;
my ($mode, $save) = $rw ? "r" : "w";
if ($do_spawn) { |
The RT System itself - Status changed from 'new' to 'open' |
From nick@ing-simmons.netSteven P Schubiger <steven@accognoscere.org> writes:
I assume that has been tested. It looks worryingly like the my $foo = "something" if (...); problem...
|
From perl5-porters@ton.iguana.beIn article <200504130242.j3D2_viU019110@accognoscere.homeunix.org>,
Isn't that getting a bit silly ? The code isn't interested in STDIN and |
From @ysthOn Wed, Apr 13, 2005 at 10:10:10PM +0100, Nick Ing-Simmons wrote:
That's not a problem with local. |
From schubiger@cpan.orgOn 13 Apr, Nick Ing-Simmons wrote: : I assume that has been tested. Yes and it does, what it's supposed to do. Steven |
From schubiger@cpan.orgOn 13 Apr, Ton Hospel wrote: : Isn't that getting a bit silly ? The code isn't interested in STDIN and I disagree. Are you aware that the handle gets blessed into Steven |
From perl5-porters@ton.iguana.beIn article <200504141028.j3EAStRF006350@accognoscere.homeunix.org>,
In that previous mail I was thinking in terms of something like: $io = IO::Handle->new; but that seems to dup in the wrong direction. |
Migrated from rt.perl.org#34931 (status was 'open')
Searchable as RT34931$
The text was updated successfully, but these errors were encountered: