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

Add --silent flag to Solana CLI for turning off stdout for error/info contexts when running commands #35621

Closed
sebscholl opened this issue Aug 6, 2024 · 1 comment

Comments

@sebscholl
Copy link

sebscholl commented Aug 6, 2024

Problem

When writing test suites for programs that wrap the Solana CLI, test runner logs get populated with unnecessary print statements (in the context of running tests) that makes the logs cluttered and difficult to read.

In a test runner (regardless of language or framework) the CLI error ends up printing to the same process as the test runner. For example, a test that's covering a failure scenario shows

image

......Error: Bad parameter: SIGNATURE
.error: Invalid value for '--signer <PUBKEY>': No such file or directory (os error 2)
.Error: Invalid signature
.

Finished in 0.39404 seconds (files took 3.66 seconds to load)
9 examples, 0 failures

Proposed Solution

It would be nice for the CLI to support error or log suppression (the opposite of the currently supported --verbose flag). When set, commands wouldn't print any contextual information or errors to the console and only return the data that they are being run to collect - or a blank value.

Example solution:

# Current
$ solana balance -k invalid_keypair
=> Error: Dynamic program error: No default signer found, run "solana-keygen new -o not_a_keypair" to create a new one
$ solana balance -k valid_keypair
=> 10 SOL

# Solution
$ solana balance -k invalid_keypair --silent
=> 
$ solana balance -k valid_keypair --silent
=> 10 SOL
Copy link
Contributor

github-actions bot commented Aug 6, 2024

This repository is no longer in use. Please re-open this issue in the agave repo: https://github.com/anza-xyz/agave

@github-actions github-actions bot closed this as completed Aug 6, 2024
@sebscholl sebscholl changed the title Add --silent flag to Solana CLI for turning of console output when running commands Add --silent flag to Solana CLI for turning off stdout for error/info contexts when running commands Aug 6, 2024
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

No branches or pull requests

1 participant