SC2: don't close all SC2 instances when one quits (#3507)

This commit is contained in:
Fabian Dill
2024-06-12 02:14:30 +02:00
committed by GitHub
parent 87d24eb38a
commit e755f1a0b5

View File

@@ -28,6 +28,11 @@ class kill_switch:
logger.debug("kill_switch: Add switch")
cls._to_kill.append(value)
@classmethod
def kill(cls, value):
logger.info(f"kill_switch: Process cleanup for 1 process")
value._clean(verbose=False)
@classmethod
def kill_all(cls):
logger.info(f"kill_switch: Process cleanup for {len(cls._to_kill)} processes")
@@ -116,7 +121,7 @@ class SC2Process:
async def __aexit__(self, *args):
logger.exception("async exit")
await self._close_connection()
kill_switch.kill_all()
kill_switch.kill(self)
signal.signal(signal.SIGINT, signal.SIG_DFL)
@property