From f147b6fd9642c0a8832f8578f8ae4f7de0cd60ff Mon Sep 17 00:00:00 2001 From: Stephane Thiell Date: Mon, 4 Jul 2022 10:14:43 -0700 Subject: [PATCH] Task: only terminate Task once (#110) Add a check using existing _terminated attribute to avoid terminating a Task multiple times, which could cause issues. Closes #110 --- lib/ClusterShell/Task.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ClusterShell/Task.py b/lib/ClusterShell/Task.py index ed744f8d..2466b0e3 100644 --- a/lib/ClusterShell/Task.py +++ b/lib/ClusterShell/Task.py @@ -950,7 +950,10 @@ def _terminate(self, kill): """ Abort completion subroutine. """ - assert self._quit == True + assert self._quit is True + + if self._terminated: + return self._terminated = True if kill: