| Index: third_party/node/node.py
|
| diff --git a/third_party/node/node.py b/third_party/node/node.py
|
| index e2e9a3774ae08c7d47d30fff5d7a18a107b72449..0194f5615501a7755b286b35989132c9f4e4f960 100755
|
| --- a/third_party/node/node.py
|
| +++ b/third_party/node/node.py
|
| @@ -5,6 +5,8 @@
|
|
|
| from os import path as os_path
|
| import platform
|
| +import subprocess
|
| +import sys
|
|
|
|
|
| def GetBinaryPath():
|
| @@ -13,3 +15,16 @@ def GetBinaryPath():
|
| 'Linux': ('linux', 'node-linux-x64', 'bin', 'node'),
|
| 'Windows': ('win', 'node.exe'),
|
| }[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)
|
| + stdout, stderr = process.communicate()
|
| +
|
| + if stderr:
|
| + print >> sys.stderr, '%s failed: %s' % (cmd, stderr)
|
| + raise
|
| +
|
| + return stdout
|
|
|