Noame has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
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);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Get Return Value from Unix
by mscharrer (Hermit) on May 01, 2008 at 11:27 UTC | |
by Noame (Beadle) on May 01, 2008 at 12:38 UTC | |
by mscharrer (Hermit) on May 01, 2008 at 13:01 UTC | |
Re: Get Return Value from Unix
by Anonymous Monk on May 01, 2008 at 11:53 UTC |
Back to
Seekers of Perl Wisdom