Skip to content

Commit 19d68f7

Browse files
author
Samus CTO
committed
[FIX] Show stderr during build process
According to pull request odoo/odoo#4039 we should log into stderr. Therefore, the stderr output of build should be logged too.
1 parent d26e383 commit 19d68f7

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

runbot/runbot.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ def cmd(self, cr, uid, ids, context=None):
697697

698698
return cmd, modules
699699

700-
def spawn(self, cmd, lock_path, log_path, cpu_limit=None, shell=False, showstderr=False):
700+
def spawn(self, cmd, lock_path, cpu_limit=None, **kwargs):
701701
def preexec_fn():
702702
os.setsid()
703703
if cpu_limit:
@@ -709,13 +709,8 @@ def preexec_fn():
709709
# close parent files
710710
os.closerange(3, os.sysconf("SC_OPEN_MAX"))
711711
lock(lock_path)
712-
out=open(log_path,"w")
713-
_logger.debug("spawn: %s stdout: %s", ' '.join(cmd), log_path)
714-
if showstderr:
715-
stderr = out
716-
else:
717-
stderr = open(os.devnull, 'w')
718-
p=subprocess.Popen(cmd, stdout=out, stderr=stderr, preexec_fn=preexec_fn, shell=shell)
712+
_logger.debug("spawn: %s", ' '.join(cmd))
713+
p=subprocess.Popen(cmd, preexec_fn=preexec_fn, **kwargs)
719714
return p.pid
720715

721716
def github_status(self, cr, uid, ids, context=None):
@@ -759,19 +754,23 @@ def job_10_test_base(self, cr, uid, build, lock_path, log_path):
759754
cmd, mods = build.cmd()
760755
if grep(build.server("tools/config.py"), "test-enable"):
761756
cmd.append("--test-enable")
762-
cmd += ['-d', '%s-base' % build.dest, '-i', 'base', '--stop-after-init', '--log-level=test', '--max-cron-threads=0']
763-
return self.spawn(cmd, lock_path, log_path, cpu_limit=300)
757+
cmd += ['-d', '%s-base' % build.dest, '-i', 'base',
758+
'--log-level=test', '--logfile=%s' % log_path,
759+
'--stop-after-init', '--max-cron-threads=0']
760+
return self.spawn(cmd, lock_path, cpu_limit=300)
764761

765762
def job_20_test_all(self, cr, uid, build, lock_path, log_path):
766763
build._log('test_all', 'Start test all modules')
767764
self.pg_createdb(cr, uid, "%s-all" % build.dest)
768765
cmd, mods = build.cmd()
769766
if grep(build.server("tools/config.py"), "test-enable"):
770767
cmd.append("--test-enable")
771-
cmd += ['-d', '%s-all' % build.dest, '-i', mods, '--stop-after-init', '--log-level=test', '--max-cron-threads=0']
768+
cmd += ['-d', '%s-all' % build.dest, '-i', mods,
769+
'--log-level=test', '--logfile=%s' % log_path,
770+
'--stop-after-init', '--max-cron-threads=0']
772771
# reset job_start to an accurate job_20 job_time
773772
build.write({'job_start': now()})
774-
return self.spawn(cmd, lock_path, log_path, cpu_limit=2100)
773+
return self.spawn(cmd, lock_path, cpu_limit=2100)
775774

776775
def job_30_run(self, cr, uid, build, lock_path, log_path):
777776
# adjust job_end to record an accurate job_20 job_time
@@ -803,7 +802,7 @@ def job_30_run(self, cr, uid, build, lock_path, log_path):
803802
# not sure, to avoid old server to check other dbs
804803
cmd += ["--max-cron-threads", "0"]
805804

806-
cmd += ['-d', "%s-all" % build.dest]
805+
cmd += ['-d', "%s-all" % build.dest, '--logfile=%s' % log_path]
807806

808807
if grep(build.server("tools/config.py"), "db-filter"):
809808
if build.repo_id.nginx:
@@ -823,7 +822,7 @@ def job_30_run(self, cr, uid, build, lock_path, log_path):
823822
# f.close()
824823
#cmd=[self.client_web_bin_path]
825824

826-
return self.spawn(cmd, lock_path, log_path, cpu_limit=None, showstderr=True)
825+
return self.spawn(cmd, lock_path, cpu_limit=None)
827826

828827
def force(self, cr, uid, ids, context=None):
829828
"""Force a rebuild"""

0 commit comments

Comments
 (0)