summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-11-21 19:06:19 -0200
committerdrebs <drebs@riseup.net>2017-11-21 20:57:17 -0200
commit5956b8e095966f91ea8d83956d0d7d46a447ddba (patch)
tree0ab218e27ea473cffaa16a435a693f9119169dc7
parent2862a01e88801955c5d833a7c87b50ffba7edd8f (diff)
[bug] use os._exit to ensure a clean log on startup failure
-rw-r--r--src/leap/soledad/server/app.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/leap/soledad/server/app.py b/src/leap/soledad/server/app.py
index 77d3a1cd..cad4f31b 100644
--- a/src/leap/soledad/server/app.py
+++ b/src/leap/soledad/server/app.py
@@ -17,7 +17,6 @@
"""
Soledad Server, as a Twisted Application.
"""
-import sys
import os
from twisted.application import service, strports
@@ -34,9 +33,12 @@ logger = getLogger(__name__)
def _exit(status):
- reactor.addSystemEventTrigger(
- 'after', 'shutdown', sys.exit, status)
- reactor.stop()
+ if reactor.running:
+ reactor.addSystemEventTrigger(
+ 'after', 'shutdown', os._exit, status)
+ reactor.stop()
+ else:
+ os._exit(status)
def _log_and_exit(failure):