From fd977b91a2ed3f5b34f454ea3086b57de05fdeb7 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Tue, 10 Feb 2026 17:53:11 -0500 Subject: [PATCH] Guard bare > stripping with has_prompt check --- src/mudlib/embedded_if_session.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mudlib/embedded_if_session.py b/src/mudlib/embedded_if_session.py index 93b3b6a..490fcd7 100644 --- a/src/mudlib/embedded_if_session.py +++ b/src/mudlib/embedded_if_session.py @@ -38,12 +38,15 @@ class EmbeddedIFSession: def _strip_prompt(self, output: str) -> str: """Strip trailing > prompt from game output (matches dfrotz behavior).""" + has_prompt = ( + output.endswith("> ") or output.endswith(">\n") or output.endswith(">\r\n") + ) text = output.rstrip() if text.endswith("\n>"): return text[:-2].rstrip() if text == ">": return "" - if text.endswith(">"): + if has_prompt and text.endswith(">"): return text[:-1].rstrip() return output