in reply to Print STDERR&STDOUT to log file and to the screen

When you execute an external command with system that command will not be affected by perl internal redirection of STDOUT.

One possible workaround to your problem is to call tee from inside system:

system ("nmake /df $object.mak CFG=\"$object - ${BUILD_CFG}$build_conf +ig\"|tee -a $buildLog");

(perhaps you also want to join STDERR and STDOUT before the tee, so insert a 2>&1 in front of the pipe.

(Update: fixed redirection thingy)

Replies are listed 'Best First'.
Re^2: Print STDERR&STDOUT to log file and to the screen
by Noame (Beadle) on Jan 23, 2008 at 18:31 UTC
    That sulotion isn't good for me, because the system will return the result of "| tee -a $buildlog" command, and not the result of 'nmake' command. I must to get return code from 'nmake' command to check if the build success or faild!!!! Thanks.