Skip to content

Commit 83e4e7f

Browse files
authored
Update input.py
1 parent 19139e1 commit 83e4e7f

1 file changed

Lines changed: 11 additions & 16 deletions

File tree

‎python_agent_harness/tui/input.py‎

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from __future__ import annotations
66

77
import os
8-
import sys
98
import threading
109
from collections.abc import Callable, Iterable
1110
from contextlib import contextmanager
@@ -44,13 +43,13 @@ def _option_label(opt: Any) -> str:
4443
@contextmanager
4544
def _safe_patch_stdout():
4645
"""patch_stdout that degrades to a no-op when the terminal output
47-
cannot be created (e.g. headless Windows CI without a console).
46+
cannot be created (e.g. headless CI without a console).
4847
4948
``patch_stdout`` fails in ``__enter__``: StdoutProxy reads
5049
``app_session.output``, which triggers ``create_output`` and raises
51-
``NoConsoleScreenBufferError`` on a headless Windows console. We
52-
force output creation up front; if it fails, skip patching (the
53-
body's own exceptions still propagate normally).
50+
when no console is available. We force output creation up front;
51+
if it fails, skip patching (the body's own exceptions still
52+
propagate normally).
5453
"""
5554
try:
5655
from prompt_toolkit.application.current import get_app_session
@@ -152,15 +151,11 @@ def _make_prompt_session(
152151
then bails out without inserting the common part). Tab must be the
153152
single, deterministic trigger.
154153
155-
``enable_suspend`` is off on Windows: Ctrl-Z (suspend) is a Unix
156-
terminal feature with no Windows equivalent.
157-
158-
On Windows without a real console (headless CI, redirected stdout),
159-
prompt_toolkit raises ``NoConsoleScreenBufferError`` while creating
160-
the default ``Win32Output``. The fallback rebuilds the session with
161-
a no-op ``DummyOutput`` so the TUI can still be constructed; on a
162-
real terminal the first attempt succeeds and the fallback is never
163-
reached.
154+
Without a real console (headless CI, redirected stdout),
155+
prompt_toolkit raises while creating the default output. The
156+
fallback rebuilds the session with a no-op ``DummyOutput`` so the
157+
TUI can still be constructed; on a real terminal the first attempt
158+
succeeds and the fallback is never reached.
164159
"""
165160
try:
166161
return PromptSession(
@@ -169,11 +164,11 @@ def _make_prompt_session(
169164
completer=completer,
170165
complete_while_typing=False,
171166
multiline=True,
172-
enable_suspend=sys.platform != "win32",
167+
enable_suspend=True,
173168
**kwargs,
174169
)
175170
except Exception:
176-
# No console available (headless Windows CI): use a no-op output.
171+
# No console available (headless CI): use a no-op output.
177172
from prompt_toolkit.output import DummyOutput
178173

179174
return PromptSession(

0 commit comments

Comments
 (0)