diff --git a/kalitectl.py b/kalitectl.py index b81135056b..0d171bb6d9 100644 --- a/kalitectl.py +++ b/kalitectl.py @@ -73,6 +73,9 @@ from socket import timeout from kalite.version import VERSION +if os.name == "nt": + from subprocess import Popen, CREATE_NEW_PROCESS_GROUP + # Necessary for loading default settings from kalite os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kalite.settings") @@ -219,7 +222,7 @@ def get_pid(): listen_port = getattr(settings, "CHERRYPY_PORT", LISTEN_PORT) # Timeout is 1 second, we don't want the status command to be slow - conn = httplib.HTTPConnection(LISTEN_ADDRESS, listen_port, timeout=3) + conn = httplib.HTTPConnection("127.0.0.1", listen_port, timeout=3) try: conn.request("GET", PING_URL) response = conn.getresponse() @@ -290,8 +293,12 @@ def manage(command, args=[], in_background=False): utility.prog_name = 'kalite manage' utility.execute() else: - thread = ManageThread(command, args=args) - thread.start() + if os.name != "nt": + thread = ManageThread(command, args=args, name=" ".join([command]+args)) + thread.start() + else: + # TODO (aron): for versions > 0.13, see if we can just have everyone spawn another process (Popen vs. ManageThread) + Popen([sys.executable, os.path.abspath(sys.argv[0]), "manage", command] + args, creationflags=CREATE_NEW_PROCESS_GROUP) def start(debug=False, args=[], skip_job_scheduler=False):