From f4b784cfa925d411af606f11109a2a23a7afd52e Mon Sep 17 00:00:00 2001 From: Greg Taylor Date: Thu, 15 Jan 2009 15:11:32 +0000 Subject: [PATCH] Use os.kill for shutting down the game instead of getting it through Popen. --- game/evennia.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/game/evennia.py b/game/evennia.py index 04bd300cf7..07f4a3c263 100755 --- a/game/evennia.py +++ b/game/evennia.py @@ -5,10 +5,10 @@ EVENNIA SERVER STARTUP SCRIPT Sets the appropriate environmental variables and launches the server process. Run the script with the -h flag to see usage information. """ -import getopt # for parsing command line arguments from optparse import OptionParser import os # for OS related fonctions import sys # for getting command line arguments +import signal from subprocess import Popen, call # Set the Python path up so we can get to settings.py from here. @@ -74,10 +74,11 @@ def stop_server(parser, options, args): """ if os.name == 'posix': if os.path.exists('twistd.pid'): - print 'Stoping The Server' + print 'Stoping the server...' f = open('twistd.pid', 'r') pid = f.read() - Popen(['kill', pid]) + os.kill(int(pid), signal.SIGINT) + print 'Server stopped.' else: print "No twistd.pid file exists, the server doesn't appear to be running." elif os.name == 'nt':