summaryrefslogtreecommitdiffstats
path: root/openstack/common/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
commit7417a6024c7fe093a54f07a1ea4f24bdd0fcc3e6 (patch)
tree18a1120e94314ad158faaaa1081f9d576cb00083 /openstack/common/setup.py
parentecdd50d4e00bf8b0607801e763cef4cb408e091f (diff)
downloadoslo-7417a6024c7fe093a54f07a1ea4f24bdd0fcc3e6.tar.gz
oslo-7417a6024c7fe093a54f07a1ea4f24bdd0fcc3e6.tar.xz
oslo-7417a6024c7fe093a54f07a1ea4f24bdd0fcc3e6.zip
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 'openstack/common/setup.py')
-rw-r--r--openstack/common/setup.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/openstack/common/setup.py b/openstack/common/setup.py
index 35680b3..2a971e7 100644
--- a/openstack/common/setup.py
+++ b/openstack/common/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: