From 842bf710322f9e8b1cd5cac1b81e08d3d3840980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 30 Nov 2015 21:39:01 +0100 Subject: Use atexit for server files cleaning --- mcwrapper | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mcwrapper b/mcwrapper index 0a936fa..99de0b3 100755 --- a/mcwrapper +++ b/mcwrapper @@ -7,6 +7,7 @@ import signal import time import datetime import traceback +import atexit from threading import Thread import importlib.machinery as imp ################################################################################# @@ -170,7 +171,6 @@ def mcexec(): """Executes cmd and parses output for server status changes. """ global prc - __server_start__() if type(conf.command) != str: conf.command = ' '.join(conf.command) if conf.verbose_level >= 1: @@ -188,7 +188,6 @@ def mcexec(): print(line.rstrip()) __parse_line__(line.rstrip()) inputThread.stopexec() - __server_clean__() ################################################################################# @@ -269,4 +268,6 @@ if __name__ == '__main__': signal.signal(signal.SIGTERM, __signal_term__) signal.signal(signal.SIGINT, __signal_term__) + __server_start__() + atexit.register(__server_clean__) mcexec() -- cgit v1.2.3