I have an python script which will invoke the nmake
. I want to invoke this script in powershell as following.
python D:\build.py -f folder
It works fine and the output is as following:
Microsoft (R) Program Maintenance Utility Version 11.00.50727.1
Copyright (C) Microsoft Corporation. All rights reserved.
But if I add the redirection to make all the stderr&stdout
goes to build.log
as following, it show red errors:
python D:\build.py -f folder 2>&1 | tee build.log
python :
At line:1 char:1
+ python D:\source_code\media\media\build_system\build.py -f xplatform_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Microsoft (R) Program Maintenance Utility Version 11.00.50727.1
Copyright (C) Microsoft Corporation. All rights reserved.
---- Edit 1----
I understand possible reason is the external nmake
executable write to stderr
, then Powershell show error.
But the first example, which without redirection, doesn't show error. And the second one, which have redirect stderr
to stdout
, actually show errors. So any reason?