Stop "fig up" containers gracefully

With double ctrl-c force.
This commit is contained in:
Ben Firshman 2014-01-02 19:18:08 +00:00
parent 6d0702e607
commit 9b289b6f3b
1 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,8 @@
import logging
import sys
import re
import signal
import sys
from inspect import getdoc
@ -229,7 +231,13 @@ class TopLevelCommand(Command):
try:
log_printer.run()
finally:
self.project.kill(service_names=options['SERVICE'])
def handler(signal, frame):
self.project.kill(service_names=options['SERVICE'])
sys.exit(0)
signal.signal(signal.SIGINT, handler)
print "Gracefully stopping... (press Ctrl+C again to force)"
self.project.stop(service_names=options['SERVICE'])
def _attach_to_container(self, container_id, interactive, logs=False, stream=True, raw=False):
stdio = self.client.attach_socket(