File tree Expand file tree Collapse file tree 1 file changed +7
-16
lines changed Expand file tree Collapse file tree 1 file changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -571,30 +571,21 @@ def main():
571571
572572 start_rest_thread (logger )
573573
574- # Ideally the signal handlers should be installed as early as possible,
575- # however that does not play well with the worker pool communication used by do_sync().
576- signal .signal (signal .SIGTERM , signal_handler )
577- signal .signal (signal .SIGINT , signal_handler )
578-
579- # Start Tomcat last. It will be the foreground process.
574+ # Start Tomcat last.
580575 logger .info ("Starting Tomcat" )
581- global tomcat_popen
582576 tomcat_popen = subprocess .Popen ([os .path .join (tomcat_root , 'bin' ,
583577 'catalina.sh' ),
584578 'run' ])
585- tomcat_popen .wait ()
586-
587579
588- def signal_handler (signum , frame ):
589- print ("Received signal {}" .format (signum ))
590-
591- global tomcat_popen
580+ sigset = set ()
581+ sigset .add (signal .SIGTERM )
582+ sigset .add (signal .SIGINT )
583+ signum = signal .sigwait (sigset )
584+ logger .info ("Received signal {}" .format (signum ))
592585 if tomcat_popen :
593- print ("Terminating Tomcat {}" .format (tomcat_popen ))
586+ logger . info ("Terminating Tomcat {}" .format (tomcat_popen ))
594587 tomcat_popen .terminate ()
595588
596- sys .exit (0 )
597-
598589
599590if __name__ == "__main__" :
600591 main ()
You can’t perform that action at this time.
0 commit comments