def safe_start(self):
        """Run the server forever, and stop it cleanly on exit."""
        try:
            self.start()
        except (KeyboardInterrupt, IOError):
            # The time.sleep call might raise
            # "IOError: [Errno 4] Interrupted function call" on KBInt.
            self.error_log('Keyboard Interrupt: shutting down')
            self.stop()
            raise
        except SystemExit:
            self.error_log('SystemExit raised: shutting down')
            self.stop()
            raise
def safe_start ( self ) : try : self . start ( ) except ( KeyboardInterrupt , IOError ) : self . error_log ( 'Keyboard Interrupt: shutting down' ) self . stop ( ) raise except SystemExit : self . error_log ( 'SystemExit raised: shutting down' ) self . stop ( ) raise
Run the server forever, and stop it cleanly on exit.