Ai
2 Star 0 Fork 0

chromium_develop/chromium_third_party_node

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
node.py 1.08 KB
一键复制 编辑 原始数据 按行查看 历史
李想 提交于 2022-08-16 16:18 +08:00 . chromium origin init
#!/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, stdout=None):
cmd = [GetBinaryPath()] + cmd_parts
process = subprocess.Popen(
cmd, cwd=os.getcwd(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
if process.returncode != 0:
# Handle cases where stderr is empty, even though the command failed, for
# example https://github.com/microsoft/TypeScript/issues/615
err = stderr if len(stderr) > 0 else stdout
raise RuntimeError('Command \'%s\' failed\n%s' % (' '.join(cmd), err))
return stdout
if __name__ == '__main__':
RunNode(sys.argv[1:])
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chromium_develop/chromium_third_party_node.git
git@gitee.com:chromium_develop/chromium_third_party_node.git
chromium_develop
chromium_third_party_node
chromium_third_party_node
master

搜索帮助