Added handling of Ctrl-C in interactive mode. Resolves #803.
This commit is contained in:
parent
f1834dc194
commit
4c6ff5b12d
2 changed files with 11 additions and 2 deletions
|
|
@ -16,6 +16,7 @@ import shutil
|
||||||
import importlib
|
import importlib
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from subprocess import Popen, check_output, call, CalledProcessError, STDOUT
|
from subprocess import Popen, check_output, call, CalledProcessError, STDOUT
|
||||||
|
import twisted
|
||||||
import django
|
import django
|
||||||
|
|
||||||
# Signal processing
|
# Signal processing
|
||||||
|
|
@ -325,6 +326,11 @@ ERROR_NODJANGO = \
|
||||||
ERROR: Django does not seem to be installed.
|
ERROR: Django does not seem to be installed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
NOTE_KEYBOARDINTERRUPT = \
|
||||||
|
"""
|
||||||
|
STOP: Caught keyboard interrupt while in interactive mode.
|
||||||
|
"""
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Functions
|
# Functions
|
||||||
|
|
@ -1039,8 +1045,10 @@ def server_operation(mode, service, interactive, profiler):
|
||||||
try:
|
try:
|
||||||
process.wait()
|
process.wait()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print "\nKeyboard interrupt sent in interactive mode.\n"
|
server_operation("stop", "portal", False, False)
|
||||||
|
return
|
||||||
|
finally:
|
||||||
|
print NOTE_KEYBOARDINTERRUPT
|
||||||
|
|
||||||
elif mode == 'reload':
|
elif mode == 'reload':
|
||||||
# restarting services
|
# restarting services
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,7 @@ def start_services(server_argv, portal_argv):
|
||||||
try:
|
try:
|
||||||
message, rc = processes.get()
|
message, rc = processes.get()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
# this only matters in interactive mode
|
||||||
break
|
break
|
||||||
|
|
||||||
# restart only if process stopped cleanly
|
# restart only if process stopped cleanly
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue