diff src/server/server.py @ 812:fd6965c16e7e

server: added "quit" method to exit with an exit code when reactor is running
author Goffi <goffi@goffi.org>
date Sun, 20 Dec 2015 20:01:40 +0100
parents 3905bc24eb17
children 6e27604ec95a
line wrap: on
line diff
--- a/src/server/server.py	Sun Dec 20 19:59:01 2015 +0100
+++ b/src/server/server.py	Sun Dec 20 20:01:40 2015 +0100
@@ -1380,6 +1380,14 @@
     def stop(self):
         reactor.stop()
 
+    def quit(self, exit_code=None):
+        """Exit app when reactor is running
+
+        @param exit_code(None, int): exit code
+        """
+        self.stop()
+        sys.exit(exit_code or 0)
+
 
 class RedirectToHTTPS(Resource):