[tbb-commits] [tor-browser/tor-browser-68.1.0esr-9.0-2] Bug 1500436 - Redirect node.js's stderr to a pipe. r=froydnj

boklm at torproject.org boklm at torproject.org
Wed Sep 11 10:25:18 UTC 2019


commit 4458b4e8a09aaa759f1735b36aec860aa61f3ba7
Author: Mike Hommey <mh+mozilla at glandium.org>
Date:   Wed Jun 26 21:44:00 2019 +0000

    Bug 1500436 - Redirect node.js's stderr to a pipe. r=froydnj
    
    This works around https://github.com/nodejs/node/issues/14752, which
    causes problems with make.
    
    Differential Revision: https://phabricator.services.mozilla.com/D35986
    
    --HG--
    extra : moz-landing-system : lando
---
 python/mozbuild/mozbuild/action/node.py | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/python/mozbuild/mozbuild/action/node.py b/python/mozbuild/mozbuild/action/node.py
index de4e094a9471..73f13ac48503 100644
--- a/python/mozbuild/mozbuild/action/node.py
+++ b/python/mozbuild/mozbuild/action/node.py
@@ -52,14 +52,25 @@ def execute_node_cmd(node_cmd_list):
         print('Executing "{}"'.format(printable_cmd), file=sys.stderr)
         sys.stderr.flush()
 
-        output = subprocess.check_output(node_cmd_list)
+        # We need to redirect stderr to a pipe because
+        # https://github.com/nodejs/node/issues/14752 causes issues with make.
+        proc = subprocess.Popen(
+            node_cmd_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+
+        stdout, stderr = proc.communicate()
+        retcode = proc.wait()
+
+        if retcode != 0:
+            print(stderr, file=sys.stderr)
+            sys.stderr.flush()
+            sys.exit(retcode)
 
         # Process the node script output
         #
         # XXX Starting with an empty list means that node scripts can
         # (intentionally or inadvertently) remove deps.  Do we want this?
         deps = []
-        for line in output.splitlines():
+        for line in stdout.splitlines():
             if 'dep:' in line:
                 deps.append(line.replace('dep:', ''))
             else:



More information about the tbb-commits mailing list