Help redirect STDOUT, STDERR under NT !!! 
Author Message
 Help redirect STDOUT, STDERR under NT !!!

My tool, written in Perl, reads a list of commands from an ASCII file
and calls them with the system call like:
system($B_sysCommand);

At the beginning it optionally redirects STDOUT and STDERR into a
logfile:

       if(!$opt_D) {
                open(LOG, ">>$B_logfile") || die "Can't open $B_logfile";
                $B_oldFh = select(LOG); $| = 1; select($B_oldFh);
                open(SAVEOUT, ">&STDOUT"); $B_oldFh = select(SAVEOUT); $| = 1;
select($B_oldFh);
                open(SAVEERR, ">&STDERR"); $B_oldFh = select(SAVEERR); $| = 1;
select($B_oldFh);
                open(STDOUT, ">&LOG") || die "Can't redirect stdout to
$B_logfile";
                open(STDERR, ">&LOG") || die "Can't redirect stderr to
$B_logfile";
        }
        $B_oldFh = select(STDOUT); $| = 1; select($B_oldFh);
        $B_oldFh = select(STDERR); $| = 1; select($B_oldFh);

This all worked for years under Unix both with Perl4 and Perl5. Now,
under WindowsNT with the latest, build 303 activeware Perl it works
without redirection but blows up when I want a logfile:

Failed in '11: d:/atools/src/tpbuild.pl $SRCPROD $DSTDIR $GZFILE
$PRODNODE $PRODLEAF $SCRIPT $VERSION'.
Exit value 9.
Signal value 0.
System error string 'Exec format error'.

The above 4 lines are produced by my script and Exit value is $? >> 8;
signal is $? & 255; and System error string is $!

My commands are perl scripts which might call other perl scripts.

What shall I do to make redirection of STDERR, STDOUT wotk under NT???
Thank you, Zach.



Sat, 04 Sep 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Redirecting STDERR to STDOUT (on NT)

2. HELP - with redirect of STDERR and STDOUT

3. HELP - with redirect of STDERR and STDOUT

4. redirect STDERR to STDOUT ?????

5. redirecting stderr and stdout

6. writing to terminal even with STDOUT and STDERR redirected

7. assigning STDERR whild redirecting STDOUT to a file

8. Problem with redirecting STDOUT and STDERR

9. How to redirect STDOUT,STDERR and keep the message order

10. Redirect stderr to stdout w/ Perl under Unix?

11. need to redirect STDOUT and STDERR

12. Redirecting stdout/stderr from a call to system()

 

 
Powered by phpBB® Forum Software