Improved exception handling for shutdown procedures
This commit is contained in:
parent
2ed041695f
commit
425d101f07
@ -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__}"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user