Skip to content

fix(cli): route warnings, errors, logs to stderr - #957

Merged
anderdc merged 1 commit into
entrius:testfrom
seroperson:jq-parse
May 8, 2026
Merged

fix(cli): route warnings, errors, logs to stderr#957
anderdc merged 1 commit into
entrius:testfrom
seroperson:jq-parse

Conversation

@seroperson

@seroperson seroperson commented May 4, 2026

Copy link
Copy Markdown
Contributor

Closes #956

Summary

This PR standardizes the output logic: stdout only for valuable data, stderr for logs/warnings/errors etc. Currently existing inconsistency breaks piping flows, like gitt issues list --json | jq, as stdout may be polluted with info which isn't relates to the calculated result.

It's a very common pattern of working with stdout/stderr (see https://clig.dev):

Send output to stdout. The primary output for your command should go to stdout. Anything that is machine readable should also go to stdout—this is where piping sends things by default.
Send messaging to stderr. Log messages, errors, and so on should all be sent to stderr. This means that when commands are piped together, these messages are displayed to the user and not fed into the next command.

And used in a wide amount of existing tools (curl, gh, kubectl etc).

Before

  • gitt issues list --json | jq fails because of polluted stdout

After

  • gitt issues list --json | jq succeeds because stdout contains only JSON output, the rest is in stderr

Test Plan

I can figure something out if necessary, but I'm really unsure whether it should be tested. Tell me if I need to cover this somehow.

@xiao-xiao-mao xiao-xiao-mao Bot added the refactor Code restructuring without behavior change label May 4, 2026
@seroperson
seroperson force-pushed the jq-parse branch 2 times, most recently from b2af9ea to a61b697 Compare May 5, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code restructuring without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: noise in stdout interfere json parsing

2 participants