From dcb83265f8b19120581160aa629680bff8f0d54c Mon Sep 17 00:00:00 2001 From: EMRG Evolution Date: Thu, 20 Aug 2026 01:21:43 +0800 Subject: [PATCH] =?UTF-8?q?emrg:=20catch=20AuthError=20in=20server=20stop/?= =?UTF-8?q?restart=20CLI=20paths=20(stale=20port=20file=20=E2=86=92=20grac?= =?UTF-8?q?eful=20fallback,=20no=20crash)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- emrg/__main__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emrg/__main__.py b/emrg/__main__.py index 6d80b507..a42cd8ac 100644 --- a/emrg/__main__.py +++ b/emrg/__main__.py @@ -25,7 +25,7 @@ from emrg import __version__ from emrg._win import win32_no_window_kwargs -from emrg.connect import cleanup_server, connect_to_server +from emrg.connect import AuthError, cleanup_server, connect_to_server from websockets.exceptions import ConnectionClosed @@ -153,7 +153,7 @@ async def _send_shutdown() -> bool: """Send a graceful shutdown message to the daemon. Returns True on success.""" try: ws = await asyncio.wait_for(connect_to_server(), timeout=3) - except (ConnectionRefusedError, FileNotFoundError, OSError, asyncio.TimeoutError): + except (ConnectionRefusedError, FileNotFoundError, OSError, asyncio.TimeoutError, AuthError): return False try: @@ -204,7 +204,7 @@ async def _get_pid(): print("daemon stopped.") else: print("daemon not running (no pid from ping).") - except (ConnectionClosed, OSError, asyncio.TimeoutError, json.JSONDecodeError): + except (ConnectionClosed, OSError, asyncio.TimeoutError, json.JSONDecodeError, AuthError): print("daemon not running.")