Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm looking for a solution for the following problem:
On Win32 (e.g. ActiveState PERL) My PERL-Scripts get invoked by a MAKEfile (NMAKE).
The whole NMAKE call may / or may not have STDERR redirected to STDOUT nmake.exe makefile target 2>&1I now want to detect if STDERR is redirected to STDOUT, to avoid duplicate writing of Warnings/Errors.
For Unix I have found something like:But this does not work under Windows. Any hints?sub dev_ino_of_handle { my $handle = shift; join (" ", (stat $handle)); } sub send_maybe_both { my $text = shift; print STDOUT $text; unless (dev_ino_of_handle(\*STDOUT) eq dev_ino_of_handle(\*STDERR)) +{ print STDERR $text; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to detect I/O redirection on Win32
by BrowserUk (Patriarch) on Sep 10, 2007 at 16:55 UTC | |
by Anonymous Monk on Sep 11, 2007 at 07:28 UTC | |
by BrowserUk (Patriarch) on Sep 11, 2007 at 07:37 UTC | |
by Anonymous Monk on Sep 11, 2007 at 09:43 UTC | |
|
Re: How to detect I/O redirection on Win32
by Roy Johnson (Monsignor) on Sep 10, 2007 at 16:21 UTC | |
by ikegami (Patriarch) on Sep 10, 2007 at 16:32 UTC | |
|
Re: How to detect I/O redirection on Win32
by Anonymous Monk on Sep 10, 2007 at 16:08 UTC |