develooper Front page | perl.perl5.porters | Postings from March 2001

Re: [ID 20000913.003] Closing STDERR leaves fd(2) marked w/o?

Thread Previous | Thread Next
From:
Warren Hyde
Date:
March 14, 2001 12:25
Subject:
Re: [ID 20000913.003] Closing STDERR leaves fd(2) marked w/o?
Message ID:
20010314141515.D20592@cpu.sps.mot.com
Quoting Gurusamy Sarathy (gsar@ActiveState.com):
> On Wed, 14 Mar 2001 10:55:11 CST, Warren Hyde wrote:
> >Warning/Error text always gets sent to file descriptor 2, and not STDERR,
> >as advertised.  The documentation for "warn" and "die" say this:
> >
> >    warn LIST
> >            Produces a message on STDERR just like `die', but doesn't exit
> >            or throw an exception...
> >    die LIST
> >            Outside an `eval', prints the value of LIST to `STDERR' and
> >            exits with the current value of `$!' (errno)...
> >
> >Begging to differ, I assert that the output does NOT go to STDERR, but it
> >really goes to file descriptor 2, whatever that may be, and whether or not
> >it is opened as an input or output source.
> 
> Can you see if this problem persists in 5.6.1-trial2 and report it
> with a short test case if it does?

The problem of warn/die messages going to descriptor 2 does not exist in
5.6.1-TRIAL2.  However 5.6.1-TRIAL2 still has the problem of printing a
warning about "Filehandle FOOBAR opened only for output..." if FOOBAR
happens to get descriptor 1 or 2 (after closing STDOUT/STDERR).

> AFAIK, the only diagnostic output
> that goes to stderr now is from passing the -D switches to perl.  All
> warnings and errors generated by the script or by perl should go
> to whatever STDERR is made to point to in the script.  (Of course,
> there are some corner cases like panic messages that need to go to
> stderr because the interpreter is not even initialized properly,
> but those aren't "normal".)
> 
> 
> Sarathy
> gsar@ActiveState.com

Cheers,
-- 
Warren.Hyde@motorola.com
Makes plans to take you to dinner at either the Plaza or Burger King,
depending on whether Bill Gates testifies that day.
    --Signs Your Significant Other is a Day Trader [topfive.com]

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