If your shell is bash, check out the PIPESTATUS shell parameter. For example, $command = "make -f <parameters> 2>&1 | tee -a build.log; let \\!PIPESTATUS"; might work, but I haven't tested it.
In reply to Re: Capture Exit Code Using Pipe & Tee
by ambrus
in thread Capture Exit Code Using Pipe & Tee
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |