core: unify atexit to always call _finalize_process (covers both self-launched and adopted servers)
This commit is contained in:
@@ -352,8 +352,8 @@ class EmbeddingServerManager:
|
|||||||
|
|
||||||
# Register atexit callback only when we actually start a process
|
# Register atexit callback only when we actually start a process
|
||||||
if not self._atexit_registered:
|
if not self._atexit_registered:
|
||||||
# Use a lambda to avoid issues with bound methods
|
# Always attempt best-effort finalize at interpreter exit
|
||||||
atexit.register(lambda: self.stop_server() if self.server_process else None)
|
atexit.register(self._finalize_process)
|
||||||
self._atexit_registered = True
|
self._atexit_registered = True
|
||||||
# Touch finalizer so it knows there is a live process
|
# Touch finalizer so it knows there is a live process
|
||||||
if getattr(self, "_finalizer", None) is not None and not self._finalizer.alive:
|
if getattr(self, "_finalizer", None) is not None and not self._finalizer.alive:
|
||||||
|
|||||||
Reference in New Issue
Block a user