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
open "-" doesn't use STDIN #15704
Comments
From @maukeCreated by @mauke% perl -we 'close STDIN; open my $fh, "-|", "echo", "foo\nbar"; open my $fh2, "<-"; print scalar readline $fh; print scalar readline STDIN; print scalar readline $fh2' This code Then it The last part is the bug: $fh2 somehow ended up aliasing $fh. I would've Perl Info
|
From @maukeOn Fri, 11 Nov 2016 04:49:38 -0800, mauke- wrote:
AFAICS this is due to the internals using PerlIO_stdin() everywhere, which simply returns the first PerlIO object in the internal table, not necessarily STDIN. STDIN is the first object internally, but closing it frees that slot and then the next handle created will be placed in that slot and treated as "stdin" by the internals, no matter what you do with STDIN afterwards. |
From zefram@fysh.orgAfter closing one of the standard I/O streams, it is normal that a -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From @maukeAm 17.12.2017 um 02:19 schrieb Zefram via RT:
This is unrelated to file descriptors: % perl -we 'close STDIN; open my $fh, q{<}, \qq{foo\nbar\n}; open my I.e. you get the same output if $fh refers to a string and doesn't use a Worse: % perl -we 'close STDIN; open my $fh, q{<}, \qq{foo\nbar\n}; open STDIN, Now we have a real STDIN handle, it's bound to file descriptor 0, and -- |
Migrated from rt.perl.org#130071 (status was 'open')
Searchable as RT130071$
The text was updated successfully, but these errors were encountered: