aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-11-30 21:39:01 +0100
committerKarel Kočí <cynerd@email.cz>2015-11-30 21:41:46 +0100
commit842bf710322f9e8b1cd5cac1b81e08d3d3840980 (patch)
tree3fe07978ccbdb1785c2b5b34e0457eac93aeaedc
parent0f8439a2cfa89a12a4eeb147f213552f687dbe5c (diff)
downloadmcserver-wrapper-842bf710322f9e8b1cd5cac1b81e08d3d3840980.tar.gz
mcserver-wrapper-842bf710322f9e8b1cd5cac1b81e08d3d3840980.tar.bz2
mcserver-wrapper-842bf710322f9e8b1cd5cac1b81e08d3d3840980.zip
Use atexit for server files cleaning
-rwxr-xr-xmcwrapper5
1 files 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()