mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-11-03 03:39:20 +08:00
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>
35 lines
873 B
Python
Executable File
35 lines
873 B
Python
Executable File
#!/usr/bin/env python
|
|
# Copyright 2017 The Chromium Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
from os import path as os_path
|
|
import platform
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
|
|
|
|
def GetBinaryPath():
|
|
return os_path.join(
|
|
os_path.dirname(__file__), *{
|
|
'Darwin': ('mac', 'node-darwin-x64', 'bin', 'node'),
|
|
'Linux': ('linux', 'node-linux-x64', 'bin', 'node'),
|
|
'Windows': ('win', 'node.exe'),
|
|
}[platform.system()])
|
|
|
|
|
|
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:])
|