Skip to content

Commit 18f79ef

Browse files
committed
Bug 1500436 - Redirect node.js's stderr to a pipe. r=froydnj a=RyanVM
This works around nodejs/node#14752, which causes problems with make. Differential Revision: https://phabricator.services.mozilla.com/D35986 --HG-- extra : source : 562655fedb9df034ae1f8c32cd730f6498d501a7
1 parent 0ab4b16 commit 18f79ef

File tree

1 file changed

+13
-2
lines changed
  • python/mozbuild/mozbuild/action

1 file changed

+13
-2
lines changed

python/mozbuild/mozbuild/action/node.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,25 @@ def execute_node_cmd(node_cmd_list):
5252
print('Executing "{}"'.format(printable_cmd), file=sys.stderr)
5353
sys.stderr.flush()
5454

55-
output = subprocess.check_output(node_cmd_list)
55+
# We need to redirect stderr to a pipe because
56+
# https://github.com/nodejs/node/issues/14752 causes issues with make.
57+
proc = subprocess.Popen(
58+
node_cmd_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
59+
60+
stdout, stderr = proc.communicate()
61+
retcode = proc.wait()
62+
63+
if retcode != 0:
64+
print(stderr, file=sys.stderr)
65+
sys.stderr.flush()
66+
sys.exit(retcode)
5667

5768
# Process the node script output
5869
#
5970
# XXX Starting with an empty list means that node scripts can
6071
# (intentionally or inadvertently) remove deps. Do we want this?
6172
deps = []
62-
for line in output.splitlines():
73+
for line in stdout.splitlines():
6374
if 'dep:' in line:
6475
deps.append(line.replace('dep:', ''))
6576
else:

0 commit comments

Comments
 (0)