From bfa04aa00ae36935b09b6718e314d4568e74ad88 Mon Sep 17 00:00:00 2001 From: Ron Frederick Date: Sat, 19 Oct 2024 08:50:46 -0700 Subject: [PATCH] Avoid error on process wait() followed by wait_closed() This commit prevents a RuntimeException from occurring when a process has wait() called on it and later a call is made to wait_closed() (such as from a context manager). Thanks go to GitHub user starflows for reporting this issue! --- asyncssh/process.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/asyncssh/process.py b/asyncssh/process.py index f2dbb3d..4d5d750 100644 --- a/asyncssh/process.py +++ b/asyncssh/process.py @@ -1210,6 +1210,8 @@ async def wait_closed(self) -> None: for task in self._cleanup_tasks: await task + self._cleanup_tasks = [] + class SSHClientProcess(SSHProcess[AnyStr], SSHClientStreamSession[AnyStr]): """SSH client process handler"""