saintmike has asked for the wisdom of the Perl Monks concerning the following question:
Both system() commands produce an error message on STDERR, but the first one gets suppressed since STDERR points to nowhere land. However, after restoring STDERR, I would expect the 2nd system() to actually print the error message. Alas, what I get is this:my @cmd = ("/bin/ls", "/doesntexist"); use vars qw(*OLDERR); open OLDERR, ">&STDERR"; open STDERR, ">/dev/null"; # STDERR suppressed system(@cmd); *STDERR = *OLDERR; print STDERR "stderr is open\n"; # STDERR should be open - but isn't system(@cmd);
which means that the print STDERR works ok, but the system()'s STDERR channel is still blocked. Is this a bug?stderr is open
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Suppress/Reactivate STDERR
by ikegami (Patriarch) on Dec 15, 2006 at 23:55 UTC | |
by nobull (Friar) on Dec 16, 2006 at 16:31 UTC | |
by ikegami (Patriarch) on Dec 16, 2006 at 18:07 UTC | |
|
Re: Suppress/Reactivate STDERR
by almut (Canon) on Dec 15, 2006 at 23:54 UTC |