From c363eed543e7532aeddb36525006d7e4cb76bc88 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Tue, 12 Feb 2019 21:32:47 -0800 Subject: [PATCH] chore: suppress output of npm_action unless it fails (#16888) --- build/npm-run.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/build/npm-run.py b/build/npm-run.py index cee5910847a..50a10564ac0 100644 --- a/build/npm-run.py +++ b/build/npm-run.py @@ -1,10 +1,18 @@ #!/usr/bin/env python import os +import subprocess import sys SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__)) -args = ["npm", "run", +cmd = "npm" +if sys.platform == "win32": + cmd += ".cmd" +args = [cmd, "run", "--prefix", SOURCE_ROOT ] + sys.argv[1:] -os.execvp("npm", args) +try: + subprocess.check_output(args, stderr=subprocess.STDOUT) +except subprocess.CalledProcessError, e: + print("NPM script '" + sys.argv[2] + "' failed with code '" + str(e.returncode) + "':\n" + e.output) + sys.exit(e.returncode)