I'm writing Perl program to execute 'nmake' command. I'm looking for the best way to execute the 'nmake' command from Perl program on Unix and to get the return value From the Unix shell. Finally, I want to print the error to log file and to the screen.
Currently I have written the following code and its work fine:The question is if it's correct to "send" all STDOUT & STDERR to log file in that way? And after I pass successfully that function how can I continue the script without print all to log file (Stop the 'tee' function) due to the command below:open (LOG, "> $buildLog") || die "-E- Can't open (write) the log file: + $buildLog\n($!)\n"; tee(STDOUT, '>>', $buildLog); tee(STDERR, '>>', $buildLog); $status = system ("nmake /f $object.mak CFG=\"$object - ${BUILD_CFG}$b +uild_config\""); if ($status) { TraceLog ("---------------------------------------"); TraceLog ("-E- nmake ended with errors! (status=$status)"); TraceLog ("---------------------------------------"); print ; &sendBuildFailure ($object); close (LOG); exit 1;
Please advice. Let me know if you need more information's. Thankstee(STDOUT, '>>', $buildLog); tee(STDERR, '>>', $buildLog);
In reply to Get Return Value from Unix by Noame
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |