mirror of
https://github.com/containers/podman-compose.git
synced 2025-05-12 18:24:56 +02:00
Fix python < 3.11 compatibility
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
This commit is contained in:
parent
c592596a5e
commit
fde7995cb8
@ -2298,6 +2298,14 @@ async def compose_up(compose: PodmanCompose, args):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def _task_cancelled(task: Task) -> bool:
|
||||||
|
if task.cancelled():
|
||||||
|
return True
|
||||||
|
# Task.cancelling() is new in python 3.11
|
||||||
|
if sys.version_info >= (3, 11) and task.cancelling():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
exit_code = 0
|
exit_code = 0
|
||||||
exiting = False
|
exiting = False
|
||||||
while tasks:
|
while tasks:
|
||||||
@ -2308,7 +2316,9 @@ async def compose_up(compose: PodmanCompose, args):
|
|||||||
# cause the status to overwrite. Sleeping for 1 seems to fix this and make it match
|
# cause the status to overwrite. Sleeping for 1 seems to fix this and make it match
|
||||||
# docker-compose
|
# docker-compose
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
_ = [_.cancel() for _ in tasks if not _.cancelling() and not _.cancelled()]
|
for t in tasks:
|
||||||
|
if not _task_cancelled(t):
|
||||||
|
t.cancel()
|
||||||
t: Task
|
t: Task
|
||||||
exiting = True
|
exiting = True
|
||||||
for t in done:
|
for t in done:
|
||||||
|
Loading…
Reference in New Issue
Block a user