Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Unified Diff: gsutil.py

Issue 828463003: Fix gsutil execution on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | win_toolchain/toolchain2013.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gsutil.py
diff --git a/gsutil.py b/gsutil.py
index 7e6bb44b2dbd91975c61c575c6e064025a0e5da3..6578d7844171202eb787bf1414c4a371e15a75a0 100755
--- a/gsutil.py
+++ b/gsutil.py
@@ -28,7 +28,9 @@ DEFAULT_FALLBACK_GSUTIL = os.path.join(
class SubprocessError(Exception):
- pass
+ def __init__(self, message=None, code=0):
+ super(SubprocessError, self).__init__(message)
+ self.code = code
class InvalidGsutilError(Exception):
@@ -46,7 +48,7 @@ def call(args, verbose=True, **kwargs):
sys.stdout.write(line)
code = proc.wait()
if code:
- raise SubprocessError('%s failed with %s' % (args, code))
+ raise SubprocessError('%s failed with %s' % (args, code), code)
return ''.join(out)
@@ -125,7 +127,11 @@ def run_gsutil(force_version, fallback, target, args):
else:
gsutil_bin = fallback
cmd = [sys.executable, gsutil_bin] + args
- os.execv(cmd[0], cmd)
+ try:
+ call(cmd)
+ except SubprocessError as e:
+ return e.code
+ return 0
def parse_args():
@@ -145,7 +151,7 @@ def parse_args():
def main():
force_version, fallback, target, args = parse_args()
- run_gsutil(force_version, fallback, target, args)
+ return run_gsutil(force_version, fallback, target, args)
if __name__ == '__main__':
sys.exit(main())
« no previous file with comments | « no previous file | win_toolchain/toolchain2013.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698