fix(windows): handle redirected stdout in _cprint fallback#28083
fix(windows): handle redirected stdout in _cprint fallback#28083Grogger wants to merge 1 commit into
Conversation
Wraps _pt_print in try/except with a print() fallback. When a kanban worker's stdout is piped to a log file, prompt_toolkit raises NoConsoleScreenBufferError (Windows) or OSError (other) because there is no real console buffer. The fallback keeps worker output flowing instead of crashing.
|
BoardJames CI triage (2026-05-18T16:46Z): I don’t see a PR-specific failure at the moment. Evidence:
Local focused validation on a detached worktree at PR head:
No code push from me; recommendation is to let |
|
Update: |
Summary
Wraps
_pt_printin try/except with aprint()fallback in_cprint. When a kanban worker's stdout is piped to a log file,prompt_toolkitraisesNoConsoleScreenBufferError(Windows) orOSError(other) because there is no real console buffer. The fallback keeps worker output flowing instead of crashing.Why
The
_cprintfunction is used by kanban workers to print status messages. On Windows, git-bash setsTERM=xterm-256color, which causesprompt_toolkitto attempt terminal initialization and fail when stdout is redirected to a log file. This was discovered when kanban workers spawned by the gateway would crash silently.How to test
On Windows 11: run a kanban worker via the dispatcher with stdout redirected to a log file. Without this fix, the worker crashes with
NoConsoleScreenBufferErroron the first_cprintcall. With the fix, output falls through toprint()and the worker continues normally.Tests:
pytest tests/cli/test_cprint_bg_thread.py— 13 passed. Fulltests/cli/suite: 634 passed, 7 pre-existing failures (tilde paths, secret capture — verified identical onmain).