From 6f071579047774cb01ade761c9462807e9078090 Mon Sep 17 00:00:00 2001 From: Goffi Date: Sat, 14 Nov 2020 21:19:40 +0100 Subject: [PATCH] core (launcher): exit code can now specified Exit code can now be specified by setting the `_exitCode` variable in `twisted.application.app` module. --- sat/core/launcher.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sat/core/launcher.py b/sat/core/launcher.py index fd86bae2..26921eb2 100644 --- a/sat/core/launcher.py +++ b/sat/core/launcher.py @@ -23,7 +23,6 @@ import os 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 @@ class Launcher: 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 @@ class Launcher: runner.run() if runner._exitSignal is not None: app._exitWithSignal(runner._exitSignal) + try: + sys.exit(app._exitCode) + except AttributeError: + pass @classmethod def run(cls):