Your first question is not really Perl related, it is an issue with the shell (cmd.exe) you are using. For example, Bash has an array of pipe return codes, however this is quite difficult in shells like csh and ksh. I don't think you can do it in cmd.exe.
However, there is an alternative using Perl. Run your build.exe in a pipe: open(my $fh, "C:\\IA71_Enterprise\\build.exe $ProjFile 2>&1 |") or die
+ "$!"
and do the tee yourself in Perl, you can get the return code from $?.
The tee utility in DOS can't redirect the STDERR output to a file You answered this question yourself in your system command. Redirect stderr (Windows file handle 2) to stdout (Windows file handle 1) before the tee using 2>&1.
By the way, this might be being pedantic, but I doubt you are actually running a DOS program. PC or MS-DOS was 16-bit, you are probably running a 32-bit console program - at least, I hope you are! | [reply] [d/l] [select] |
| [reply] [d/l] [select] |
I didn't think DOS recognised either STDERR or filehandle 2
If the OP is using real DOS then you are correct, but if cmd.exe is being used (more likely) then the syntax is similar to the Bourne, Bash, and Korn shells. Windows console processes use the first three file handles (0, 1, 2) in the same way as UNIX processes use the first three file descriptors.
| [reply] |
redirect stderr to a file and tee that file? | [reply] |