From 78d4c4628a92267ab1ca328cfe017b51db6a5e46 Mon Sep 17 00:00:00 2001 From: Amjith Ramanujam Date: Sat, 25 Jan 2025 19:21:51 -0800 Subject: [PATCH 1/2] Redirect both stdout and stderr while capturing output. --- litecli/packages/special/llm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/litecli/packages/special/llm.py b/litecli/packages/special/llm.py index 0cf4c6f..f18495b 100644 --- a/litecli/packages/special/llm.py +++ b/litecli/packages/special/llm.py @@ -36,9 +36,10 @@ def run_external_cmd(cmd, *args, capture_output=False, restart_cli=False, raise_ if capture_output: buffer = io.StringIO() - redirect = contextlib.redirect_stdout(buffer) + redirect = contextlib.ExitStack() + redirect.enter_context(contextlib.redirect_stdout(buffer)) + redirect.enter_context(contextlib.redirect_stderr(buffer)) else: - # Use nullcontext to do nothing when not capturing output redirect = contextlib.nullcontext() with redirect: @@ -172,7 +173,6 @@ def initialize_llm(): if click.confirm("This feature requires additional libraries. Install LLM library?", default=True): click.echo("Installing LLM library. Please wait...") run_external_cmd("pip", "install", "--quiet", "llm", restart_cli=True) - ensure_litecli_template() def ensure_litecli_template(replace=False): From b3b61395f2f9c4bdf8d1de226c3f5a471b964448 Mon Sep 17 00:00:00 2001 From: Amjith Ramanujam Date: Sat, 25 Jan 2025 19:26:49 -0800 Subject: [PATCH 2/2] Update changelog for 1.14.1 release. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4aa5281..baeecd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.14.1 - 2025-01-25 + +### Bug Fixes + +* Capture stderr in addition to stdout when capturing output from `llm` cli. + ## 1.14.0 - 2025-01-22 ### Features