diff options
author | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2013-02-15 10:46:18 -0500 |
---|---|---|
committer | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2013-02-15 10:46:18 -0500 |
commit | ad8a8de3c938069f78985ceb118fb0ce9ae074e8 (patch) | |
tree | 8982e654eff31ebd29099252bba2f69b2a411887 /setup.py | |
parent | 5ad695d521cb5f03f34c0028a4d30c830af4c79a (diff) | |
download | pbr-ad8a8de3c938069f78985ceb118fb0ce9ae074e8.tar.gz |
returncode for Popen is valid only after communicate call
Found when testing a bug in cinder (1125416), code
relying on throw_on_error won't work because returncode
is None if checked before the communicate() method is
called
Change-Id: I8c9dd00396346ec3ad7bbe1dc17643c385da8d6f
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -117,9 +117,9 @@ def _run_shell_command(cmd, throw_on_error=False): output = subprocess.Popen(["/bin/sh", "-c", cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out = output.communicate() if output.returncode and throw_on_error: raise Exception("%s returned %d" % cmd, output.returncode) - out = output.communicate() if len(out) == 0: return None if len(out[0].strip()) == 0: |