Skip to content

[eas-cli] Write the reason a command failed to stderr - #4592

Open
vonovak wants to merge 2 commits into
vonovak/dependency-notice-ttyfrom
vonovak/failure-reason-stderr
Open

vonovak wants to merge 2 commits into
vonovak/dependency-notice-ttyfrom
vonovak/failure-reason-stderr

Conversation

@vonovak

@vonovak vonovak commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

When a command fails, EasCommand.catch prints the (helpful) reason with Log.error, which writes to stdout. Then oclif prints <command> command failed. to stderr. A program that reads stderr for the error finds only the generic (not helpful) line.

Stacked on #4591. This is the second of four PRs: #4591 ← #4592 (this PR) ← #4593 ← #4594.

How

Add Log.errorToStderr and use it in EasCommand.catch only. Other Log.error and Log.warn calls stay on stdout:

  • Some Log.error calls are not failures and exit 0, for example in env:get and env:delete.
  • ora.ts keeps non-TTY output on stdout on purpose, because some CI systems treat stderr as a failure. A failing command already writes to stderr through oclif, so this PR adds no new stderr output to a run that succeeds.

With --json, nothing changes: stdout was already redirected to stderr.

Trade-off: a program that reads stderr for errors now finds the reason there, and a program that parses stdout no longer gets the reason mixed into it. A program that reads the reason from stdout must read stderr instead, so the changelog lists this under breaking changes. The callers in this repo that run eas-cli (build-tools and eas-build-cache-provider) read stdout only on success. On failure they log stderr or merge both streams.

Known limit: Log.errorToStderr uses chalk, which picks its color level from stdout. With eas ... 2>err.log in a terminal, the file gets color codes.

LLM Authorship

  • Vojtech asked for errors on stderr. Claude Code wrote the change.

Test Plan

  • Real run, not logged in, build:list --non-interactive: the reason (Either log in with eas login ...) is on stderr, next to Error: build:list command failed.. On 24.12.1 it was on stdout.
  • tsc, oxlint and oxfmt are clean.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.48%. Comparing base (7f317ab) to head (0f3bb8d).

Files with missing lines Patch % Lines
packages/eas-cli/src/log.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@                        Coverage Diff                        @@
##           vonovak/dependency-notice-tty    #4592      +/-   ##
=================================================================
- Coverage                          74.48%   74.48%   -0.00%     
=================================================================
  Files                               1029     1029              
  Lines                              50390    50393       +3     
  Branches                           10891    10891              
=================================================================
  Hits                               37528    37528              
- Misses                             11872    11875       +3     
  Partials                             990      990              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vonovak
vonovak added this pull request to stack #4595 October 9, 2026 19:52
@vonovak
vonovak force-pushed the vonovak/failure-reason-stderr branch from 0559704 to 3cb54f7 Compare October 12, 2026 08:04
@vonovak
vonovak marked this pull request as ready for review October 12, 2026 08:08
@github-actions

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
packages/eas-cli/** @douglowder

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

@vonovak
vonovak requested a review from douglowder October 12, 2026 08:08
@douglowder

Copy link
Copy Markdown
Contributor

eas-cli now uses changesets for changelogs (#4580). The required "Check for a changeset" check fails on PRs that edit CHANGELOG.md.

To update this PR:

  1. Revert the changes to CHANGELOG.md.
  2. Run yarn changeset, select the changed packages and the bump type, and write the summary.
  3. Commit the new file in .changeset/.

The release adds the PR link and the author to the entry. If this PR needs no changelog entry, revert the CHANGELOG.md changes and add the "no changelog" label.

EasCommand.catch printed the reason with Log.error, which writes to
stdout. oclif then printed "<command> command failed." to stderr. A
program that reads stderr for the error found only that generic line.

Only the catch changes. Other Log.error and Log.warn calls stay on
stdout, because some of them are not failures and the spinner keeps
non-TTY output off stderr on purpose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vonovak
vonovak force-pushed the vonovak/failure-reason-stderr branch from 3cb54f7 to e9ab32e Compare October 15, 2026 14:41
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ Thank you for adding a changeset!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants