Stop "fig up" containers gracefully
With double ctrl-c force.
This commit is contained in:
parent
6d0702e607
commit
9b289b6f3b
1 changed files with 9 additions and 1 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
|
import signal
|
||||||
|
import sys
|
||||||
|
|
||||||
from inspect import getdoc
|
from inspect import getdoc
|
||||||
|
|
||||||
|
|
@ -229,7 +231,13 @@ class TopLevelCommand(Command):
|
||||||
try:
|
try:
|
||||||
log_printer.run()
|
log_printer.run()
|
||||||
finally:
|
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):
|
def _attach_to_container(self, container_id, interactive, logs=False, stream=True, raw=False):
|
||||||
stdio = self.client.attach_socket(
|
stdio = self.client.attach_socket(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue