public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] [edk2/BaseTools] edksetup.bat stuck on unicode locale Windows
@ 2019-12-11 22:42 Park, Aiden
  2019-12-18  5:23 ` Bob Feng
  0 siblings, 1 reply; 7+ messages in thread
From: Park, Aiden @ 2019-12-11 22:42 UTC (permalink / raw)
  To: devel@edk2.groups.io

This issue happens under two conditions.
  1. Unicode language environment in Windows
  2. Call 'edksetup.bat forcerebuild' with python subprocess.call()

Steps to reproduce
  C:\edk2>python
  Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40)
  Type help, copyright, credits or license for more information.
  >>> import subprocess
  >>> subprocess.call(['edksetup.bat', 'forcerebuild'])

  The edksetup.bat stuck at 'nmake cleanall'.

One of multi-threads is on deadlock when python handles stdout and
stderr in a subprocess pipe only if the outputs include unicode chars.
Only stderr will be handled in the pipe same as a single thread call.

Reported in Slim Bootloader.
  https://github.com/slimbootloader/slimbootloader/issues/478
Local fix has been made in Slim Bootloader.
  https://github.com/slimbootloader/slimbootloader/pull/490

Signed-off-by: Aiden Park <aiden.park@intel.com>
---
 BaseTools/Source/C/Makefiles/NmakeSubdirs.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/Makefiles/NmakeSubdirs.py b/BaseTools/Source/C/Makefiles/NmakeSubdirs.py
index 356f5ac..c77bfb0 100644
--- a/BaseTools/Source/C/Makefiles/NmakeSubdirs.py
+++ b/BaseTools/Source/C/Makefiles/NmakeSubdirs.py
@@ -33,7 +33,7 @@ def RunCommand(WorkDir=None, *Args, **kwargs):
     if "stderr" not in kwargs:
         kwargs["stderr"] = subprocess.STDOUT
     if "stdout" not in kwargs:
-        kwargs["stdout"] = subprocess.PIPE
+        kwargs["stdout"] = sys.stdout
     p = subprocess.Popen(Args, cwd=WorkDir, stderr=kwargs["stderr"], stdout=kwargs["stdout"])
     stdout, stderr = p.communicate()
     message = ""
-- 
2.10.2.windows.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-12-20 18:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-11 22:42 [PATCH] [edk2/BaseTools] edksetup.bat stuck on unicode locale Windows Park, Aiden
2019-12-18  5:23 ` Bob Feng
2019-12-20  0:23   ` aiden.park
2019-12-20  6:12     ` Bob Feng
2019-12-20  7:03       ` Park, Aiden
2019-12-20  8:19         ` Bob Feng
2019-12-20 18:08           ` Park, Aiden

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