Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eas-cli] Silence all non-command output in non-interactive mode of eas env:exec #2800

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wschurman
Copy link
Member

@wschurman wschurman commented Jan 6, 2025

Why

When using this programmatically to run a command, env:exec shouldn't modify the stdout of the sub-command. This makes it possible to run a JSON command, for example.

Concretely, this came up in https://github.com/expo/expo-github-action/pull/316/files#diff-9a4c8863ad4d04f246a265d420c404b948ffcd8902e7de5312c9205cd034fa2eR226 where we are trying to run npx expo-updates fingerprint:generate which outputs JSON.

How

One solution (this solution) is to slightly overload the non-interactive flag to also silence all non-command output. Alternatively we could add a separate flag.

I chose to overload the existing flag since I couldn't think of a reason that a non-interactive scenario would want the Log.log calls. That being said, I'm open to adding a separate flag like --raw or --passthrough or something else if overloading the flag is not desired.

Test Plan

Before:

$ neas env:exec preview "npx expo config --json --type public" --non-interactive
No environment variables with visibility "Plain text" and "Sensitive" found for the "preview" environment on EAS servers.

Running command: npx expo config --json --type public
[stdout] {"name":"pkfsa...

After:

$ neas env:exec preview "npx expo config --json --type public" --non-interactive
{"name":"pkfsa...

Other tests:

Does not print hello since subcommand had nonzero exit status:

$ neas env:exec preview "npx expo config --json --type publicd" --non-interactive && echo "hello"

Ensure output (no output) matches:

npx expo config --json --type publicd && echo "hello"

Prints hello after config (correct success exit status):

$ neas env:exec preview "npx expo config --json --type public" --non-interactive && echo "hello"
{"name":"pkfsa...
hello

Ensure output (no output) matches:

npx expo config --json --type public && echo "hello"

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

github-actions bot commented Jan 6, 2025

Size Change: -1.63 kB (0%)

Total Size: 53.4 MB

Filename Size Change
./packages/eas-cli/dist/eas-linux-x64.tar.gz 53.4 MB -1.63 kB (0%)

compressed-size-action

@wschurman wschurman marked this pull request as ready for review January 6, 2025 19:11
Copy link

github-actions bot commented Jan 6, 2025

Subscribed to pull request

File Patterns Mentions
**/* @szdziedzic, @khamilowicz, @sjchmiela, @radoslawkrzemien

Generated by CodeMention

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.

Project coverage is 52.49%. Comparing base (f05d6ca) to head (163c212).

Files with missing lines Patch % Lines
packages/eas-cli/src/commands/env/exec.ts 0.00% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2800      +/-   ##
==========================================
- Coverage   52.52%   52.49%   -0.03%     
==========================================
  Files         583      583              
  Lines       22589    22602      +13     
  Branches     4452     4458       +6     
==========================================
  Hits        11862    11862              
- Misses      10692    10705      +13     
  Partials       35       35              

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

Copy link
Member

@szdziedzic szdziedzic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good idea overall, thanks 🙏

I have one suggestion:

packages/eas-cli/src/commands/env/exec.ts Outdated Show resolved Hide resolved
@wschurman wschurman force-pushed the @wschurman/01-06-_eas-cli_silence_all_non-command_output_in_non-interactive_mode_of_eas_env_exec branch from 09c685e to 163c212 Compare January 7, 2025 22:31
Copy link

github-actions bot commented Jan 7, 2025

✅ Thank you for adding the changelog entry!

@wschurman wschurman requested a review from szdziedzic January 7, 2025 22:35
Copy link
Member

@szdziedzic szdziedzic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me, thanks! 🙏

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