mirror of
https://github.com/containers/podman-compose.git
synced 2025-04-18 14:39:00 +02:00
add try-except block to handle error in case of shutdown error
Signed-off-by: Mohammad Kazemi <mokazemi@disroot.org>
This commit is contained in:
parent
3973c476c4
commit
b748c2666c
@ -2780,9 +2780,14 @@ async def compose_up(compose: PodmanCompose, args):
|
||||
tasks = set()
|
||||
|
||||
async def handle_sigint():
|
||||
log.info("Caught SIGINT, shutting down...")
|
||||
log.info("Caught SIGINT or Ctrl+C, shutting down...")
|
||||
try:
|
||||
log.info("Shutting down gracefully, please wait...")
|
||||
down_args = argparse.Namespace(**dict(args.__dict__, volumes=False))
|
||||
await compose.commands["down"](compose, down_args)
|
||||
except Exception as e:
|
||||
log.error(f"Error during shutdown: {e}")
|
||||
finally:
|
||||
for task in tasks:
|
||||
task.cancel()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user