Skip to content

Commit

Permalink
Merge pull request #3152 from MCGallaspy/windows-cli-fixes
Browse files Browse the repository at this point in the history
It was the cronserver mgmt command all along
  • Loading branch information
aronasorman committed Mar 10, 2015
2 parents 50b8108 + 6eb28ee commit 31b231a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions kalitectl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 31b231a

Please sign in to comment.