changeset 3416:d7cfb031e41f

core (launcher): exit code can now specified Exit code can now be specified by setting the `_exitCode` variable in `twisted.application.app` module.
author Goffi <goffi@goffi.org>
date Sat, 14 Nov 2020 21:19:40 +0100
parents 814e118d9ef3
children bfe9ebd253a7
files sat/core/launcher.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sat/core/launcher.py	Thu Nov 12 14:53:16 2020 +0100
+++ b/sat/core/launcher.py	Sat Nov 14 21:19:40 2020 +0100
@@ -23,7 +23,6 @@
 import argparse
 from pathlib import Path
 from configparser import ConfigParser
-from os.path import expanduser, join
 from twisted.application import app
 from twisted.python import usage
 from sat.core.constants import Const as C
@@ -100,7 +99,7 @@
                     print(f"Still waiting for {self.APP_NAME} to be terminated…")
             elif state == 'waiting' and now - kill_started > 10:
                 state == 'killing'
-                print(f"Waiting for too long, we kill the process")
+                print("Waiting for too long, we kill the process")
                 os.kill(pid, signal.SIGKILL)
                 sys.exit(1)
 
@@ -233,6 +232,10 @@
             runner.run()
             if runner._exitSignal is not None:
                 app._exitWithSignal(runner._exitSignal)
+            try:
+                sys.exit(app._exitCode)
+            except AttributeError:
+                pass
 
     @classmethod
     def run(cls):