From 65b5c3ad2070f6e24c4a672a426b6ed55d6e4414 Mon Sep 17 00:00:00 2001 From: Brian Krabach Date: Wed, 1 Apr 2026 01:23:07 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20ttyd=20dies=20immediately=20=E2=80=94=20?= =?UTF-8?q?add=20start=5Fnew=5Fsession=3DTrue=20to=20subprocess=20spawn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without start_new_session=True, ttyd inherits the parent's process group and gets cleaned up when the asyncio transport is garbage collected after the HTTP handler completes. start_new_session=True detaches ttyd into its own process group so it survives independently of the parent. --- muxplex/ttyd.py | 1 + 1 file changed, 1 insertion(+) diff --git a/muxplex/ttyd.py b/muxplex/ttyd.py index e26a3d6..4d71c6f 100644 --- a/muxplex/ttyd.py +++ b/muxplex/ttyd.py @@ -213,6 +213,7 @@ async def spawn_ttyd(session_name: str) -> asyncio.subprocess.Process: session_name, stdout=asyncio.subprocess.DEVNULL, stderr=asyncio.subprocess.DEVNULL, + start_new_session=True, # detach from parent process group so ttyd survives independently ) # Write PID file (create parent dirs if needed)