diff options
Diffstat (limited to 'tools/shared.py')
-rw-r--r-- | tools/shared.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/shared.py b/tools/shared.py index c0c5313f..63dcefca 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -85,10 +85,6 @@ class WindowsPopen: except: pass # Mute all exceptions in dtor, particularly if we didn't use a response file, self.response_filename doesn't exist. -# Install our replacement Popen handler if we are running on Windows to avoid python spawn process function. -if os.name == 'nt': - Popen = WindowsPopen - __rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) def path_from_root(*pathelems): return os.path.join(__rootpath__, *pathelems) @@ -251,6 +247,19 @@ except Exception, e: logging.error('Error in evaluating %s (at %s): %s, text: %s' % (EM_CONFIG, CONFIG_FILE, str(e), config_text)) sys.exit(1) +try: + EM_POPEN_WORKAROUND +except: + EM_POPEN_WORKAROUND = os.environ.get('EM_POPEN_WORKAROUND') + +# Install our replacement Popen handler if we are running on Windows to avoid python spawn process function. +# nb. This is by default disabled since it has the adverse effect of buffering up all logging messages, which makes +# builds look unresponsive (messages are printed only after the whole build finishes). Whether this workaround is needed +# seems to depend on how the host application that invokes emcc has set up its stdout and stderr. +if EM_POPEN_WORKAROUND and os.name == 'nt': + logging.debug('Installing Popen workaround handler to avoid bug http://bugs.python.org/issue3905') + Popen = WindowsPopen + # Expectations EXPECTED_LLVM_VERSION = (3,2) |