mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-29 16:57:00 +08:00
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:
committed by
Commit Bot
parent
2a6329084e
commit
0cbb83a5ec
Vendored
+8
-3
@@ -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:])
|
||||
|
||||
Reference in New Issue
Block a user