From 425d101f0778454bde30f86f96e39a4b7628ed67 Mon Sep 17 00:00:00 2001 From: Ezri Brimhall Date: Thu, 4 Sep 2025 09:44:27 -0600 Subject: [PATCH] Improved exception handling for shutdown procedures --- src/vpn_manager_globalprotect/backend.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vpn_manager_globalprotect/backend.py b/src/vpn_manager_globalprotect/backend.py index b5da280..17cb137 100644 --- a/src/vpn_manager_globalprotect/backend.py +++ b/src/vpn_manager_globalprotect/backend.py @@ -358,14 +358,17 @@ class GlobalProtectConnection( if self._wait_task is not None: self._wait_task.cancel() self._disconnecting = True - self._proc.terminate() + try: + self._proc.terminate() + except: + # Process doesn't exist, we are in the state we want so... :shrug: this is fine + return # If the process takes longer than 10 seconds to exit, kill it sith WIGKILL try: async with timeout(10): await self._proc_wait_task except TimeoutError: self._proc.kill() - await self._proc_wait_task async def temporary_disconnect(self): f"""{super().temporary_disconnect.__doc__}"""