summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorharlowja <harlowja@virtualbox.rhel>2012-06-26 07:56:54 -0700
committerharlowja <harlowja@virtualbox.rhel>2012-06-26 07:56:54 -0700
commit620afaecf0832fa539afa13ae0844e5582fc85f6 (patch)
tree444c7586be46d89a40040b0f6bc5f8e7c51f07b2 /setup.py
parent060844af4ec1f9d2d2d7c8763988b4131043dc91 (diff)
downloadvyos-cloud-init-620afaecf0832fa539afa13ae0844e5582fc85f6.tar.gz
vyos-cloud-init-620afaecf0832fa539afa13ae0844e5582fc85f6.zip
Copy the tiny_p from the packager code
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/setup.py b/setup.py
index 402443ea..810ebb48 100755
--- a/setup.py
+++ b/setup.py
@@ -29,10 +29,20 @@ import setuptools
import subprocess
-def tiny_p(cmd):
- sp = subprocess.Popen(cmd, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, stdin=None)
+
+def tiny_p(cmd, capture=True):
+ # Darn python 2.6 doesn't have check_output (argggg)
+ stdout = subprocess.PIPE
+ stderr = subprocess.PIPE
+ if not capture:
+ stdout = None
+ stderr = None
+ sp = subprocess.Popen(cmd, stdout=stdout,
+ stderr=stderr, stdin=None)
(out, err) = sp.communicate()
+ if sp.returncode not in [0]:
+ raise RuntimeError("Failed running %s [rc=%s] (%s, %s)"
+ % (cmd, sp.returncode, out, err))
return (out, err)