Skip to content

Commit d0ad299

Browse files
authored
Merge pull request #201 from dbcli/redirect-stderr
Redirect both stdout and stderr while capturing output.
2 parents d06888a + b3b6139 commit d0ad299

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.14.1 - 2025-01-25
2+
3+
### Bug Fixes
4+
5+
* Capture stderr in addition to stdout when capturing output from `llm` cli.
6+
17
## 1.14.0 - 2025-01-22
28

39
### Features

litecli/packages/special/llm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ def run_external_cmd(cmd, *args, capture_output=False, restart_cli=False, raise_
3636

3737
if capture_output:
3838
buffer = io.StringIO()
39-
redirect = contextlib.redirect_stdout(buffer)
39+
redirect = contextlib.ExitStack()
40+
redirect.enter_context(contextlib.redirect_stdout(buffer))
41+
redirect.enter_context(contextlib.redirect_stderr(buffer))
4042
else:
41-
# Use nullcontext to do nothing when not capturing output
4243
redirect = contextlib.nullcontext()
4344

4445
with redirect:
@@ -172,7 +173,6 @@ def initialize_llm():
172173
if click.confirm("This feature requires additional libraries. Install LLM library?", default=True):
173174
click.echo("Installing LLM library. Please wait...")
174175
run_external_cmd("pip", "install", "--quiet", "llm", restart_cli=True)
175-
ensure_litecli_template()
176176

177177

178178
def ensure_litecli_template(replace=False):

0 commit comments

Comments
 (0)