Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: abp_rewrite.py

Issue 11039026: Use a subprocess wrapper that will throw if a command returns a non-zero result code (Closed)
Patch Set: Created July 4, 2013, 7:18 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | autotest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: abp_rewrite.py
===================================================================
--- a/abp_rewrite.py
+++ b/abp_rewrite.py
@@ -1,32 +1,30 @@
#!/usr/bin/env python
# coding: utf-8
# This Source Code is subject to the terms of the Mozilla Public License
# version 2.0 (the "License"). You can obtain a copy of the License at
# http://mozilla.org/MPL/2.0/.
-import sys, os, subprocess, utils
+import sys, os, utils
def doRewrite(files, args):
application = utils.ensureJSShell()
env = {
'LD_LIBRARY_PATH': os.path.relpath(os.path.dirname(application)),
}
baseDir = os.path.dirname(utils.__file__)
command = [
application, os.path.join(baseDir, 'jshydra.js'),
os.path.join(baseDir, 'scripts', 'abprewrite.js'),
'--arg', ' '.join(args)
] + files
- result, dummy = subprocess.Popen(command, stdout=subprocess.PIPE, env=env).communicate()
- result = result.replace('\r', '')
- return result
+ return utils.run(command, utils.STREAMS_STDOUT, env=env).replace('\r', '')
if __name__ == '__main__':
try:
scriptArgsStart = sys.argv.index('--arg')
except ValueError:
scriptArgsStart = len(sys.argv)
print doRewrite(sys.argv[1:scriptArgsStart], sys.argv[scriptArgsStart + 1:])
« no previous file with comments | « no previous file | autotest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld