diff --git a/src/timeout_executor/terminate.py b/src/timeout_executor/terminate.py index b94032d..957daab 100644 --- a/src/timeout_executor/terminate.py +++ b/src/timeout_executor/terminate.py @@ -110,8 +110,9 @@ def close(self, name: str | None = None) -> None: logger.debug("%r try to terminate process from %s", self, name or "unknown") process = self.callback_args.process if process.returncode is None: - process.terminate() - self.is_active = True + with suppress(ProcessLookupError): + process.terminate() + self.is_active = True if process.stdout is not None: text = process.stdout.read()