# HG changeset patch # User raptorbot # Date 1263600064 0 # Node ID 5e5ae3e212b3aa647bb69c624850206720db6c27 # Parent f293a5f26578e30af917d007405026d88a5b5e74 Stderr to a file - avoid xml problems in error messages. diff -r f293a5f26578 -r 5e5ae3e212b3 sbsv2/raptor/python/raptor_make.py --- a/sbsv2/raptor/python/raptor_make.py Fri Jan 15 20:20:21 2010 +0000 +++ b/sbsv2/raptor/python/raptor_make.py Sat Jan 16 00:01:04 2010 +0000 @@ -30,6 +30,8 @@ from raptor_makefile import * import traceback import sys +from xml.sax.saxutils import escape + # raptor_make module classes @@ -403,7 +405,7 @@ command = self.buildCommand if self.makefileOption: - command += " " + self.makefileOption + " " + '"' + str(makefile) + '"' + command += " " + self.makefileOption + " " + ' "' + str(makefile) + '" ' if self.raptor.keepGoing and self.keepGoingOption: command += " " + self.keepGoingOption @@ -449,6 +451,11 @@ if addTargets: command += " " + " ".join(addTargets) + # Send stderr to a file so that it can't mess up the log (e.g. + # clock skew messages from some build engines. + stderrfilename = makefile+'.stderr' + command += ' 2>"%s"' % stderrfilename + # Substitute the makefile name for any occurrence of #MAKEFILE# command = command.replace("#MAKEFILE#", str(makefile)) @@ -469,6 +476,7 @@ makeenv['TALON_SHELL']=self.talonshell makeenv['TALON_BUILDID']=str(self.buildID) makeenv['TALON_TIMEOUT']=str(self.talontimeout) + if self.raptor.filesystem == "unix": p = subprocess.Popen([command], bufsize=65535, stdout=subprocess.PIPE, @@ -476,7 +484,7 @@ close_fds=True, env=makeenv, shell=True) else: p = subprocess.Popen(args = - [raptor_data.ToolSet.shell, '-c', command, '2>' + makefile+'.stderr'], + [raptor_data.ToolSet.shell, '-c', command], bufsize=65535, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -490,6 +498,14 @@ line = stream.readline() self.raptor.out.write(line) + try: + e = open(stderrfilename,"r") + for line in e: + self.raptor.out.write(escape(line)) + e.close() + except Exception,e: + self.raptor.Error("Couldn't complete stderr output for %s - '%s'", str(e), command) + # should be done now returncode = p.wait()