develooper Front page | perl.perl5.porters | Postings from February 2013

Re: [perl #116659] closing STDIN causes warning when openingunrelated file

Thread Previous | Thread Next
From:
Eirik Berg Hanssen
Date:
February 7, 2013 14:47
Subject:
Re: [perl #116659] closing STDIN causes warning when openingunrelated file
Message ID:
CAHAeAG55CpyAivqVrWP-aLziktwAEbXRH5eZL3L2XFvYU9VhLw@mail.gmail.com
On Thu, Feb 7, 2013 at 2:56 PM, David Golden <xdg@xdg.me> wrote:

> On Wed, Feb 6, 2013 at 2:08 PM, Aaron Crane <arc@cpan.org> wrote:
> > I don't know what hoops Capture::Tiny jumps through in this case, but
> > AFAICT, that logic should work in Perl space just as well as in C
> > space.
>
> If I recall, if it sees STDIN closed, it opens it to
> File::Spec->devnull for the duration of the capture (while monkeying
> around extensively with handles) and then closes it again afterwards.
>

  I'd rather perl did not jump through that particular hoop without being
asked ...

  Beyond performance and wasted file handles, I'd say something about not
trying to keep people from doing stupid things, as that would also keep
them from doing clever things.

  But why is there even a warning here?  I read perldiag, but found no
rationale.

  (What might break?  Do some system prevent output on file handle 0?
Could a child process inherit this fd0, and blow up since it is opened, but
not for reading?)

  If there really is a reason, it'd be nice if perldiag gave it. :)


Eirik

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About