From 9a8b8f0e0ae1606c5e505cc3decca1aa3d646ed7 Mon Sep 17 00:00:00 2001 From: Dominikus Nold Date: Fri, 27 Mar 2026 00:08:08 +0100 Subject: [PATCH] fix(scripts): CliRunner without mix_stderr for Click 8.3+ compatibility Default CliRunner() merges stderr into stdout; read stdout only so accessing result.stderr does not raise when streams are combined. Made-with: Cursor --- scripts/check-docs-commands.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/check-docs-commands.py b/scripts/check-docs-commands.py index da29a7b0..485c5787 100644 --- a/scripts/check-docs-commands.py +++ b/scripts/check-docs-commands.py @@ -143,7 +143,7 @@ def validate_command_tokens(tokens: list[str]) -> tuple[bool, str]: if not tokens: return True, "" - runner = CliRunner(mix_stderr=False) + runner = CliRunner() last_err = "" for k in range(len(tokens), 0, -1): prefix = tokens[:k] @@ -151,7 +151,8 @@ def validate_command_tokens(tokens: list[str]) -> tuple[bool, str]: exc = getattr(result, "exception", None) if result.exit_code == 0 and exc is None: return True, "" - err = (result.stderr or result.stdout or getattr(result, "output", None) or "").strip() + # CliRunner default merges stderr into stdout; ``result.stderr`` raises if not split. + err = (result.stdout or "").strip() if exc is not None: last_err = f"{type(exc).__name__}: {exc!s}"[:800] else: