core (launcher): exit code can now specified

Exit code can now be specified by setting the `_exitCode` variable in
`twisted.application.app` module.
This commit is contained in:
Goffi 2020-11-14 21:19:40 +01:00
commit 6f07157904

View file

@ -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):