@@ -697,7 +697,7 @@ def cmd(self, cr, uid, ids, context=None):
697
697
698
698
return cmd , modules
699
699
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 ):
701
701
def preexec_fn ():
702
702
os .setsid ()
703
703
if cpu_limit :
@@ -709,13 +709,8 @@ def preexec_fn():
709
709
# close parent files
710
710
os .closerange (3 , os .sysconf ("SC_OPEN_MAX" ))
711
711
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 )
719
714
return p .pid
720
715
721
716
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):
759
754
cmd , mods = build .cmd ()
760
755
if grep (build .server ("tools/config.py" ), "test-enable" ):
761
756
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 )
764
761
765
762
def job_20_test_all (self , cr , uid , build , lock_path , log_path ):
766
763
build ._log ('test_all' , 'Start test all modules' )
767
764
self .pg_createdb (cr , uid , "%s-all" % build .dest )
768
765
cmd , mods = build .cmd ()
769
766
if grep (build .server ("tools/config.py" ), "test-enable" ):
770
767
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' ]
772
771
# reset job_start to an accurate job_20 job_time
773
772
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 )
775
774
776
775
def job_30_run (self , cr , uid , build , lock_path , log_path ):
777
776
# 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):
803
802
# not sure, to avoid old server to check other dbs
804
803
cmd += ["--max-cron-threads" , "0" ]
805
804
806
- cmd += ['-d' , "%s-all" % build .dest ]
805
+ cmd += ['-d' , "%s-all" % build .dest , '--logfile=%s' % log_path ]
807
806
808
807
if grep (build .server ("tools/config.py" ), "db-filter" ):
809
808
if build .repo_id .nginx :
@@ -823,7 +822,7 @@ def job_30_run(self, cr, uid, build, lock_path, log_path):
823
822
# f.close()
824
823
#cmd=[self.client_web_bin_path]
825
824
826
- return self .spawn (cmd , lock_path , log_path , cpu_limit = None , showstderr = True )
825
+ return self .spawn (cmd , lock_path , cpu_limit = None )
827
826
828
827
def force (self , cr , uid , ids , context = None ):
829
828
"""Force a rebuild"""
0 commit comments