in reply to Re: Capture Exit Code Using Pipe & Tee
in thread Capture Exit Code Using Pipe & Tee

merlyn's answer was dead on, for some reason it earlier it wasn't returning an error code, now with a minor tweak to merlyn's code I was able to get it working exactly like I wanted. THANKS A MILLION! This is a best place on the net for anything perl. I will be donating some $$$....

my code for completeness:

open MAKE, "make -f <params> 2>&1 |" or die; open (LOGFILE, ">>build.log") or die; while (<MAKE>) { print LOGFILE $_; print } close MAKE; # to get $? my $exit = $? >> 8; close LOGFILE;

Edit: g0n - code tags

Replies are listed 'Best First'.
Re^3: Capture Exit Code Using Pipe & Tee
by Anonymous Monk on Jul 08, 2010 at 20:46 UTC
    the code wasn't actually returning the error code for the make file as far as i could tell. I used it to run any program, and had to add this at the end:
    exit $exit;

      the code wasn't actually returning the error code for the make file as far as i could tell.

      Correct, because that wasn't the question. The question was about obtaining make's exit code.