Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopting background before stop and kill #4634

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions compose/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import re
import subprocess
import sys
import time
from distutils.spawn import find_executable
from inspect import getdoc
from operator import attrgetter
Expand Down Expand Up @@ -52,7 +53,6 @@
from .utils import human_readable_file_size
from .utils import yesno


if not IS_WINDOWS_PLATFORM:
from dockerpty.pty import PseudoTerminal, RunOperation, ExecOperation

Expand Down Expand Up @@ -1200,7 +1200,11 @@ def up_shutdown_context(project, service_names, timeout, detached):
signals.set_signal_handler_to_shutdown()
try:
try:
yield
try:
yield
except signals.ShutdownException:
print("Backgrounding in 2 seconds ... (press Ctrl+c again to stop)")
time.sleep(2)
except signals.ShutdownException:
print("Gracefully stopping... (press Ctrl+C again to force)")
project.stop(service_names=service_names, timeout=timeout)
Expand Down