summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorDavanum Srinivas <dims@linux.vnet.ibm.com>2013-02-15 10:46:18 -0500
committerDavanum Srinivas <dims@linux.vnet.ibm.com>2013-02-15 10:46:18 -0500
commitad8a8de3c938069f78985ceb118fb0ce9ae074e8 (patch)
tree8982e654eff31ebd29099252bba2f69b2a411887 /setup.py
parent5ad695d521cb5f03f34c0028a4d30c830af4c79a (diff)
downloadpbr-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.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/setup.py b/setup.py
index 35680b3..2a971e7 100644
--- a/setup.py
+++ b/setup.py
@@ -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: