aboutsummaryrefslogtreecommitdiff
path: root/tools/shared.py
diff options
context:
space:
mode:
authorJez Ng <me@jezng.com>2013-06-27 03:20:31 -0700
committerJez Ng <me@jezng.com>2013-06-28 14:26:34 -0700
commit6ad00c3582044c9464f3064262af0609da2ad788 (patch)
treea7f1d01a82f7deb990e91f3ac17db3aebef2a12c /tools/shared.py
parent7695d1a474ec0433e5b2c3100933b4047b83a4b9 (diff)
Some tweaks to make CSmith easier to setup / debug.
Diffstat (limited to 'tools/shared.py')
-rw-r--r--tools/shared.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/shared.py b/tools/shared.py
index da6d3e57..776001cd 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -1379,6 +1379,17 @@ def execute(cmd, *args, **kw):
logging.error('Invoking Process failed: <<< ' + cmd + ' >>>')
raise
+def check_execute(cmd, *args, **kw):
+ # TODO: use in more places. execute doesn't actually check that return values
+ # are nonzero
+ try:
+ kw['stderr'] = STDOUT
+ subprocess.check_output(cmd, *args, **kw)
+ logging.debug("Successfuly executed %s" % " ".join(cmd))
+ except subprocess.CalledProcessError as e:
+ logging.error("'%s' failed with output:\n%s" % (" ".join(e.cmd), e.output))
+ raise
+
def suffix(name):
parts = name.split('.')
if len(parts) > 1: