Open
Conversation
15828ab to
8cfda11
Compare
bruce-hill
reviewed
Feb 20, 2026
Comment on lines
+20
to
+29
| // Always output to stderr, in case we want to also output JSON so that the json is redirectable e.g. to jq. | ||
| opts = append(opts, tea.WithOutput(os.Stderr)) | ||
|
|
||
| // If not a TTY, use stdin and disable renderer | ||
| if !term.IsTerminal(int(os.Stderr.Fd())) { | ||
| opts = append(opts, | ||
| tea.WithInput(os.Stdin), | ||
| tea.WithoutRenderer(), | ||
| ) | ||
| } |
Contributor
There was a problem hiding this comment.
This logic is a bit suspicious to me. I think it would be helpful to expand on the comments here and/or rework the logic a bit.
Scenario 1: using the tool with no pipes -> output to stderr?
Scenario 2: using the tool and piping stdout somewhere -> output charm stuff to stderr?
Scenario 3: using the tool and piping stderr somewhere -> read from stdin, output charm stuff to stderr, and no charm rendering?
I would expect the logic to look more like:
if !isatty(stdout) { // stdout is being piped somewhere
if isatty(stderr) { // stderr is still a tty, we can use that for TUI stuff
// output = stderr
} else { // no tty on either stdout/stderr, this would be the agent case
// disable output, force stdin as input instead of tty input
}
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I confirmed this works with claude code now, though still not super well. Hoping to improve that soon.