Fix gsutil execution on Windows.

5498b95831de0711fda19f2aabac4645ffb6cc78 runs gsutil using 'os.execv',
which, on Windows, apparently causes it to return before completion.

Also add verbosity to '7z' failures on toolchain downloading.

BUG=chromium:445425
TEST=bot
  - Ran on bot, this fix solves the problem that we were seeing.

R=pgervais@chromium.org, sergeyberezin@chromium.org

Review URL: https://codereview.chromium.org/828463003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293507 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gsutil.py b/gsutil.py
index 7e6bb44..6578d78 100755
--- a/gsutil.py
+++ b/gsutil.py
@@ -28,7 +28,9 @@
 
 
 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 @@
       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 @@
   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 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())