handle KeyboardInterrupt

When running zuul in non-daemon mode (with -d), it is often useful to
abort it using Control + C.

Change-Id: I385a41625633f3120b95c07283bef015824e5853
Reviewed-on: https://review.openstack.org/13571
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Antoine Musso 2012-09-24 13:25:28 +02:00 committed by Jenkins
parent 40b9907cd3
commit 6ad5d5b1af
1 changed files with 5 additions and 2 deletions

View File

@ -101,8 +101,11 @@ class Server(object):
signal.signal(signal.SIGHUP, self.reconfigure_handler)
signal.signal(signal.SIGUSR1, self.exit_handler)
while True:
signal.pause()
try:
signal.pause()
except KeyboardInterrupt:
print "Ctrl + C: asking scheduler to exit nicely...\n"
self.exit_handler( signal.SIGINT, None )
if __name__ == '__main__':
server = Server()