summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdeheader14
1 files changed, 7 insertions, 7 deletions
diff --git a/deheader b/deheader
index c1d3cc5..2dcf4cb 100755
--- a/deheader
+++ b/deheader
@@ -29,7 +29,7 @@ on interrupt or after processing with its original timestamp, unless the
The last line of the output is a statistical summary of operations.
"""
-import sys, os, getopt, time, re, operator
+import sys, os, getopt, time, re, operator, commands
BATON_DEBUG = 1
PROGRESS_DEBUG = 2
@@ -1336,18 +1336,18 @@ def trim(line):
else:
return `line`
-def testcompile(source, maker, msg="", verbosity=0):
+def testcompile(source, maker, msg="", verbosity=0, showerrs=False):
"Test-compile a sourcefile. Return the status and the compilation time"
(stem, suffix) = os.path.splitext(source)
derived = stem + ".o"
if os.path.exists(derived):
os.remove(derived)
command = maker + " " + derived
- if verbosity < COMMAND_DEBUG:
- command += " >/dev/null 2>&1"
start = time.time()
- status = os.system(command)
+ (status, output) = commands.getstatusoutput(command)
end = time.time()
+ if (os.WIFEXITED(status) and os.WEXITSTATUS(status) != 0 and showerrs) or verbosity >= COMMAND_DEBUG:
+ sys.stdout.write(output)
if status:
explain = "failed"
if verbosity >= PROGRESS_DEBUG:
@@ -1385,7 +1385,7 @@ def c_analyze(sourcefile, maker, includes, requires, verbosity):
retain += 1
if not retain:
saveit.remove_headers([header])
- (st, t) = testcompile(sourcefile, maker, " without %s" % trim(header), verbosity)
+ (st, t) = testcompile(sourcefile, maker, " without %s" % trim(header), verbosity, showerrs=False)
if st == 0:
unneeded.append(header)
includes.remove(header)
@@ -1407,7 +1407,7 @@ def c_analyze(sourcefile, maker, includes, requires, verbosity):
def deheader(sourcefile, maker, includes, requires, remove, verbose):
# Sanity check against broken sourcefiles; we want this to
# complain visibly if the sourcefile won't build at all.
- (st, t) = testcompile(sourcefile, maker, verbosity=max(1, verbose))
+ (st, t) = testcompile(sourcefile, maker, verbosity=max(1, verbose), showerrs=True)
if st == 0:
# Now do the analysis
if sourcefile.endswith(".c") or sourcefile.endswith(".cpp"):