Skip to content

Commit

Permalink
Bug 1500436 - Redirect node.js's stderr to a pipe. r=froydnj
Browse files Browse the repository at this point in the history
This works around nodejs/node#14752, which
causes problems with make.

Differential Revision: https://phabricator.services.mozilla.com/D35986

--HG--
extra : moz-landing-system : lando
  • Loading branch information
glandium authored and boklm committed Sep 11, 2019
1 parent 56be840 commit 4458b4e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions python/mozbuild/mozbuild/action/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4458b4e

Please sign in to comment.