mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
SC2: don't close all SC2 instances when one quits (#3507)
This commit is contained in:
@@ -28,6 +28,11 @@ class kill_switch:
|
|||||||
logger.debug("kill_switch: Add switch")
|
logger.debug("kill_switch: Add switch")
|
||||||
cls._to_kill.append(value)
|
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
|
@classmethod
|
||||||
def kill_all(cls):
|
def kill_all(cls):
|
||||||
logger.info(f"kill_switch: Process cleanup for {len(cls._to_kill)} processes")
|
logger.info(f"kill_switch: Process cleanup for {len(cls._to_kill)} processes")
|
||||||
@@ -116,7 +121,7 @@ class SC2Process:
|
|||||||
async def __aexit__(self, *args):
|
async def __aexit__(self, *args):
|
||||||
logger.exception("async exit")
|
logger.exception("async exit")
|
||||||
await self._close_connection()
|
await self._close_connection()
|
||||||
kill_switch.kill_all()
|
kill_switch.kill(self)
|
||||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Reference in New Issue
Block a user