Hi All,
I'm executing 'nmake' command from Perl program:
$status = system ("nmake -f TEST.mak CFG=\"TEST - Win32 Solaris_R +elease\"");
I need to catch the return code of 'nmake' command, check the results and send message accordantly (Success/Failed). Moreover, I want to print the outputs of the command in log file and on the screen. I've wrote the following codes to support those requirements:
open(STDOUT, "|tee -a $buildLog") || die "Can't redirect stdou +t: $buildLog";</span> open(STDERR, ">&STDOUT") || die "Can't dup stdout"; $status = system ("nmake /df $object.mak CFG=\"$object + - ${BUILD_CFG}$build_config\""); close(STDERR); close(STDOUT); if ($status) {</span> print "-E- nmake end with errors!:\n$statuss\n"; exit 1; } else { print nmake finished successfully\n"; }
Please advice if it is correct to "send" STDOUT to STDOUT or if you have other idea to implement it.
Thanks.
20080211 Janitored by Corion: Removed font tags, added code tags, as per Writeup Formatting Tips
In reply to Print STDERR&STDOUT to log file and to the screen by Noame
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |