public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] Basetools: Keep StdErr in screen when StdOut in file
@ 2021-04-01  7:06 Yuwei Chen
  0 siblings, 0 replies; only message in thread
From: Yuwei Chen @ 2021-04-01  7:06 UTC (permalink / raw)
  To: devel; +Cc: Bob Feng, Liming Gao, Wenyi Xie

Currently, when using GCC toolchain and loging the StdOut into files,
the StdErr will also be logged into files without shown in screen.
This patch fixes this issue.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3278

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Wenyi Xie <xiewenyi2@huawei.com>
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
---
 BaseTools/Source/Python/build/build.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index c4cfe38ad96a..a8210479d851 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -233,7 +233,10 @@ def LaunchCommand(Command, WorkingDir,ModuleAuto = None):
     EndOfProcedure = None
     try:
         # launch the command
-        Proc = MakeSubProc(Command, stdout=PIPE, stderr=STDOUT, env=os.environ, cwd=WorkingDir, bufsize=-1, shell=True)
+        if ModuleAuto.ToolChainFamily == TAB_COMPILER_MSFT:
+            Proc = MakeSubProc(Command, stdout=PIPE, stderr=STDOUT, env=os.environ, cwd=WorkingDir, bufsize=-1, shell=True)
+        else:
+            Proc = MakeSubProc(Command, stdout=PIPE, stderr=PIPE, env=os.environ, cwd=WorkingDir, bufsize=-1, shell=True)
 
         # launch two threads to read the STDOUT and STDERR
         EndOfProcedure = Event()
@@ -244,6 +247,11 @@ def LaunchCommand(Command, WorkingDir,ModuleAuto = None):
             StdOutThread.setDaemon(False)
             StdOutThread.start()
 
+        if Proc.stderr:
+            StdErrThread = Thread(target=ReadMessage, args=(Proc.stderr, EdkLogger.quiet, EndOfProcedure,Proc.ProcOut))
+            StdErrThread.setName("STDERR-Redirector")
+            StdErrThread.setDaemon(False)
+            StdErrThread.start()
 
         # waiting for program exit
         Proc.wait()
@@ -260,6 +268,9 @@ def LaunchCommand(Command, WorkingDir,ModuleAuto = None):
     if Proc.stdout:
         StdOutThread.join()
 
+    if Proc.stderr:
+        StdErrThread.join()
+
     # check the return code of the program
     if Proc.returncode != 0:
         if not isinstance(Command, type("")):
-- 
2.27.0.windows.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-01  7:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-01  7:06 [PATCH 1/1] Basetools: Keep StdErr in screen when StdOut in file Yuwei Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox