Allow node.py to run node scripts

If third_party/node/node.py is executed as a regular script,
it will consequently run the Node script with the node version
that is synced with gclient sync.

DISABLE_THIRD_PARTY_CHECK=Node Python fix
R=liviurau@chromium.org

Bug: 1074325
Change-Id: I738dc3de5dabdef349f90dfc972acd99f139c027
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2194873
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
This commit is contained in:
Tim van der Lippe
2020-05-13 09:10:31 +00:00
committed by Commit Bot
parent 2a6329084e
commit 0cbb83a5ec
3 changed files with 10 additions and 5 deletions
+8 -3
View File
@@ -7,6 +7,7 @@ from os import path as os_path
import platform
import subprocess
import sys
import os
def GetBinaryPath():
@@ -18,12 +19,16 @@ def GetBinaryPath():
}[platform.system()])
def RunNode(cmd_parts, stdout=None):
cmd = " ".join([GetBinaryPath()] + cmd_parts)
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
def RunNode(cmd_parts):
cmd = [GetBinaryPath()] + cmd_parts
process = subprocess.Popen(cmd, cwd=os.getcwd())
stdout, stderr = process.communicate()
if stderr:
raise RuntimeError('%s failed: %s' % (cmd, stderr))
return stdout
if __name__ == '__main__':
RunNode(sys.argv[1:])