diff --git a/game/runner.py b/game/runner.py index c30685e4e7..a8327a7328 100644 --- a/game/runner.py +++ b/game/runner.py @@ -160,19 +160,7 @@ def start_services(server_argv, portal_argv): return queue.put(("portal_stopped", rc)) # this signals the controller that the program finished - try: - if server_argv: - # start server as a reloadable thread - SERVER = thread.start_new_thread(server_waiter, (processes, )) - except IOError, e: - print "Server IOError: %s\nA possible explanation for this is that 'twistd' is not found." % e - return - if portal_argv: - if is_pypy: - # This is a hack; without it, the *server* stalls out and never finishes loading under PyPy. - time.sleep(1) - try: if get_restart_mode(PORTAL_RESTART) == "True": # start portal as interactive, reloadable thread @@ -180,13 +168,19 @@ def start_services(server_argv, portal_argv): else: # normal operation: start portal as a daemon; we don't care to monitor it for restart PORTAL = Popen(portal_argv) - if not SERVER: - # if portal is daemon and no server is running, we have no reason to continue to the loop. - return + except IOError, e: print "Portal IOError: %s\nA possible explanation for this is that 'twistd' is not found." % e return + try: + if server_argv: + # start server as a reloadable thread + SERVER = thread.start_new_thread(server_waiter, (processes, )) + except IOError, e: + print "Server IOError: %s\nA possible explanation for this is that 'twistd' is not found." % e + return + # Reload loop while True: