Avoid getting broken pipe errors in logs

This commit is contained in:
Martin Trigaux 2014-06-17 14:15:36 +02:00
parent 4413315e86
commit ad834107c3

View File

@ -548,7 +548,7 @@ class runbot_build(osv.osv):
return cmd, mods
def spawn(self, cmd, lock_path, log_path, cpu_limit=None, shell=False):
def spawn(self, cmd, lock_path, log_path, cpu_limit=None, shell=False, hidestderr=False):
def preexec_fn():
os.setsid()
if cpu_limit:
@ -562,7 +562,11 @@ class runbot_build(osv.osv):
lock(lock_path)
out=open(log_path,"w")
_logger.debug("spawn: %s stdout: %s", ' '.join(cmd), log_path)
p=subprocess.Popen(cmd, stdout=out, stderr=out, preexec_fn=preexec_fn, shell=shell)
if hidestderr:
stderr = out
else:
stderr = open(os.devnull, 'w')
p=subprocess.Popen(cmd, stdout=out, stderr=stderr, preexec_fn=preexec_fn, shell=shell)
return p.pid
def github_status(self, cr, uid, ids, context=None):