From 8bcb6082acf83db8e199f1065fa065340d82de0d Mon Sep 17 00:00:00 2001 From: Grogger <18091625+Grogger@users.noreply.github.com> Date: Mon, 18 May 2026 20:00:01 -0700 Subject: [PATCH] fix(windows): handle redirected stdout in _cprint fallback 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. --- cli.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cli.py b/cli.py index 528c49cca2..036e233d3c 100644 --- a/cli.py +++ b/cli.py @@ -1785,7 +1785,16 @@ def _cprint(text: str): # direct prompt_toolkit print is safe and matches existing behavior # (spinner frames, streamed tokens, tool activity prefixes, …). if app is None or not getattr(app, "_is_running", False): - _pt_print(_PT_ANSI(text)) + try: + _pt_print(_PT_ANSI(text)) + except Exception: + # Fallback when stdout is not a real console (e.g. subprocess + # worker logging to a file). prompt_toolkit raises + # NoConsoleScreenBufferError (Windows) or OSError (other). + try: + print(text) + except Exception: + pass return try: