Index: gsutil.py |
diff --git a/gsutil.py b/gsutil.py |
index 6578d7844171202eb787bf1414c4a371e15a75a0..eb87e6b007faf8eec1ed2985c9fa17d9a77621c9 100755 |
--- a/gsutil.py |
+++ b/gsutil.py |
@@ -37,19 +37,9 @@ class InvalidGsutilError(Exception): |
pass |
-def call(args, verbose=True, **kwargs): |
- kwargs['stdout'] = subprocess.PIPE |
- kwargs['stderr'] = subprocess.STDOUT |
- proc = subprocess.Popen(args, **kwargs) |
- out = [] |
- for line in proc.stdout: |
- out.append(line) |
- if verbose: |
- sys.stdout.write(line) |
- code = proc.wait() |
- if code: |
- raise SubprocessError('%s failed with %s' % (args, code), code) |
- return ''.join(out) |
+def call(args): |
+ return subprocess.call( |
+ args, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr) |
scottmg
2015/01/23 22:07:23
stdout=None, etc means it uses the parent's, which
hinoka
2015/01/23 23:47:40
Oh yep, you're right. Confirmed locally.
|
def download_gsutil(version, target_dir): |
@@ -79,6 +69,7 @@ def download_gsutil(version, target_dir): |
# Do the download. |
url = '%s%s' % (GSUTIL_URL, filename) |
u = urllib2.urlopen(url) |
+ print >> sys.stderr, 'Downloading gsutil from %s...' % url |
pgervais
2015/01/23 21:59:18
This is changing the output of the vanilla gsutil
hinoka
2015/01/23 23:47:40
Removed this printout
|
with open(target_filename, 'wb') as f: |
while True: |
buf = u.read(4096) |
@@ -90,11 +81,7 @@ def download_gsutil(version, target_dir): |
def check_gsutil(gsutil_bin): |
"""Run gsutil version and make sure it runs.""" |
- try: |
- call([sys.executable, gsutil_bin, 'version'], verbose=False) |
- return True |
- except SubprocessError: |
- return False |
+ return call([sys.executable, gsutil_bin, 'version']) == 0 |
def ensure_gsutil(version, target): |