From: David G. <dv...@us...> - 2006-06-30 08:03:59
|
Update of /cvsroot/os-sim/agent/ossim_agent In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7493 Modified Files: Agent.py Log Message: better KeyboardInterrupt handler Index: Agent.py =================================================================== RCS file: /cvsroot/os-sim/agent/ossim_agent/Agent.py,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- Agent.py 29 Jun 2006 17:08:34 -0000 1.19 +++ Agent.py 30 Jun 2006 08:03:55 -0000 1.20 @@ -140,7 +140,8 @@ os.remove(pidfile) # shutdown output plugins - self.watchdog.shutdown() + if self.watchdog: + self.watchdog.shutdown() Output.shutdown() # kill program @@ -152,23 +153,22 @@ # Wait for a Control-C and kill all threads def waitforever(self): while 1: - - try: - time.sleep(1) - except KeyboardInterrupt: - self.shutdown() + time.sleep(1) def main(self): - self.init_logger() - self.check_pid() - self.daemonize() - self.connect_server() - self.init_output() - self.init_plugins() - self.init_watchdog() - self.waitforever() + try: + self.init_logger() + self.check_pid() + self.daemonize() + self.connect_server() + self.init_output() + self.init_plugins() + self.init_watchdog() + self.waitforever() + except KeyboardInterrupt: + self.shutdown() if __name__ == "__main__": |