mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-28 21:24:26 +08:00
Bug: none Change-Id: I1be301aeac1ba08708bd03869fa0bf5b2ff6272f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6190538 Reviewed-by: Simon Zünd <szuend@chromium.org> Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
39 lines
1.1 KiB
Python
Executable File
39 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env vpython3
|
|
# 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.
|
|
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
|
|
from node_path import GetBinaryPath
|
|
|
|
|
|
def RunNode(cmd_parts, output=subprocess.PIPE):
|
|
cmd = [GetBinaryPath()] + cmd_parts
|
|
process = subprocess.Popen(cmd,
|
|
cwd=os.getcwd(),
|
|
stdout=output,
|
|
stderr=output,
|
|
universal_newlines=True)
|
|
stdout, stderr = process.communicate()
|
|
|
|
if process.returncode != 0:
|
|
print('%s failed:\n%s\n%s' % (cmd, stdout, stderr))
|
|
exit(process.returncode)
|
|
|
|
return stdout
|
|
|
|
|
|
if __name__ == '__main__':
|
|
args = sys.argv[1:]
|
|
# Accept --output as the first argument, and then remove
|
|
# it from the args entirely if present.
|
|
if len(args) > 0 and args[0] == '--output':
|
|
output = None
|
|
args = sys.argv[2:]
|
|
else:
|
|
output = subprocess.PIPE
|
|
RunNode(args, output)
|