diff options
Diffstat (limited to 'clang/utils/analyzer/SATestUtils.py')
-rw-r--r-- | clang/utils/analyzer/SATestUtils.py | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/clang/utils/analyzer/SATestUtils.py b/clang/utils/analyzer/SATestUtils.py index 9220acc1bdb..2320652619e 100644 --- a/clang/utils/analyzer/SATestUtils.py +++ b/clang/utils/analyzer/SATestUtils.py @@ -37,18 +37,6 @@ def which(command, paths=None): return None -class flushfile(object): - """ - Wrapper to flush the output after every print statement. - """ - def __init__(self, f): - self.f = f - - def write(self, x): - self.f.write(x) - self.f.flush() - - def hasNoExtension(FileName): (Root, Ext) = os.path.splitext(FileName) return (Ext == "") @@ -71,14 +59,15 @@ def getSDKPath(SDKName): return check_output(Cmd, shell=True).rstrip() -def runScript(ScriptPath, PBuildLogFile, Cwd): +def runScript(ScriptPath, PBuildLogFile, Cwd, Stdout=sys.stdout, + Stderr=sys.stderr): """ Run the provided script if it exists. """ if os.path.exists(ScriptPath): try: if Verbose == 1: - print " Executing: %s" % (ScriptPath,) + Stdout.write(" Executing: %s\n" % (ScriptPath,)) check_call("chmod +x '%s'" % ScriptPath, cwd=Cwd, stderr=PBuildLogFile, stdout=PBuildLogFile, @@ -88,8 +77,8 @@ def runScript(ScriptPath, PBuildLogFile, Cwd): stdout=PBuildLogFile, shell=True) except: - print "Error: Running %s failed. See %s for details." % ( - ScriptPath, PBuildLogFile.name) + Stderr.write("Error: Running %s failed. See %s for details.\n" % ( + ScriptPath, PBuildLogFile.name)) sys.exit(-1) |