Fix event loop handling for Windows platform in compose_up function

Signed-off-by: Alexandre Pita <alexandreanpita@gmail.com>
This commit is contained in:
Alexandre Pita 2025-02-26 14:38:46 +00:00
parent dd01d039bf
commit 784d798dac

View File

@ -2776,7 +2776,9 @@ async def compose_up(compose: PodmanCompose, args):
max_service_length = curr_length if curr_length > max_service_length else max_service_length max_service_length = curr_length if curr_length > max_service_length else max_service_length
tasks = set() tasks = set()
if sys.platform == 'win32':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
else:
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
loop.add_signal_handler(signal.SIGINT, lambda: [t.cancel("User exit") for t in tasks]) loop.add_signal_handler(signal.SIGINT, lambda: [t.cancel("User exit") for t in tasks])