Repository navigation
fix(cli): Send command hints to stderr when stdout is piped - #2594
Merged
Merged
Conversation
The command wrapper wrote a command's returned hint to stdout whenever --json was off, even when stdout was not a TTY. So `$(sentry release propose-version)` captured the version plus a "Detected from git HEAD" line, and scripts piped through `head -n 1`, which hides a failing exit code. writeFinalization now writes the hint to stdout only when stdout is a TTY. Otherwise it goes to stderr. A renderer's finalize() still runs on stdout, without the hint, so streaming tables keep their footer. JSON mode is unchanged. Test mocks that assert a hint on stdout now model a terminal. Fixes #2531 Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Piped stdout no longer carries hints (#2531), so the e2e run sees the "No logs found" notice on stderr.
BYK
approved these changes
Nov 30, 2026
sentry-junior Bot
added a commit
that referenced
this pull request
Nov 30, 2026
Keeps --allow-empty skipping a missing (ENOENT) directory alongside main's --wait/--no-wait and --no-rewrite changes. The two tests that read the missing-directory hint now read stderr, since #2594 sends hints there when stdout is not a TTY. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
This branch was successfully deployed
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.
Fixes #2531
In human mode, the command wrapper (
writeFinalizationinpackages/cli/src/lib/command.ts) wrote a command's returned hint to stdout whenever--jsonwas off, even when stdout was not a TTY. Scripts that capture the output ofsentry release propose-versiongot the version plus a "Detected from git HEAD" line, and worked around it by piping throughhead -n 1, which hides a failing exit code.Now the hint goes to stdout only when stdout is a TTY, and to stderr otherwise. The check reads
isTTYon the context's stdout writer, assentry apialready does. It applies to every command that returns a hint, including pagination, dry-run, and cache-age footers.finalize(), such as the streaming log table, still close their output on stdout, but get no hint when piped.--jsonoutput is unchanged.isTTY, so their hints also leave the captured text. JSON-mode SDK calls are unaffected.The design doc,
packages/cli/AGENTS.md, and the CLI docs describe the new rule.Once this ships, callers that use
head -n 1can drop it: thesentry wizardport in #2529 and getsentry/sentry#132671.via @BYK.
--
View Session [Sentry]