This error message might occur with any of the tools like Updater, Merger, … from the ASAP2 Tool-Set. Here is an example using the Updater:
After executing the batch file, the log file buildlog.log contains the following error:
<ERROR> The handle is invalid.
Without the command 2>&1 | no error is written to the log file.
The issue is caused by position controlled outputs in the console. These commands are used for the progress view into the console. The ASAP2-Toolset writes the progress view into the console (0%... 100%). To write this progress view the cursor of the console has to be positioned to the beginning every time the progress view is updated.
For example the progress view has the value 50% at the moment. Now, the progress view changes to 56%, but the 56% should be written at the same position as the 50% were written before (and not after the 50%). So the cursor has to be positioned to the beginning of the 50% and then the 50% is overwritten with 56%. The STDOUT is redirected by the command 2>&1| to the Mtee.exe tool and this results into issues in combination with position controlled outputs.
This issue might occur for any cases where the standard output (console) is somehow forwarded to other tools/applications. This is for instance the case if MATLAB is used in this context.