changeset 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 b1826adbeeff
children 6e27604ec95a
files src/server/server.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
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):