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

feat: allow for stdout to be buffered on each command #2335

Merged
merged 4 commits into from
Nov 17, 2023

Conversation

spiffcs
Copy link
Contributor

@spiffcs spiffcs commented Nov 17, 2023

Summary

Fixes #2334

The latest release of syft saw a regression where the version command, which uses stdout, was being swallowed by another patch that was introduced to help prevent other libraries from printing to stdout. This fix makes the stdout buffering to be opt-in on each command instead of applying to the entire application.

Testing

Added CLI test to prove that this is now being sent to stdout.

Branch

go run cmd/syft/main.go version
Application: syft
Version:    [not provided]
BuildDate:  [not provided]
GitCommit:  [not provided]
GitDescription: [not provided]
Platform:   darwin/amd64
GoVersion:  go1.21.3
Compiler:   gc

Main

go run cmd/syft/main.go version

Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
@spiffcs spiffcs requested review from kzantow and a team November 17, 2023 15:32
spiffcs and others added 2 commits November 17, 2023 11:20
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman wagoodman changed the title feat: add preRun func to version to restore stdout feat: allow for stdout to be buffered on each command Nov 17, 2023
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Copy link
Contributor

@kzantow kzantow left a comment

Choose a reason for hiding this comment

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

👍

@wagoodman wagoodman merged commit ba80e49 into main Nov 17, 2023
10 checks passed
@wagoodman wagoodman deleted the patch-version-stdout branch November 17, 2023 19:14
@wagoodman wagoodman added bug Something isn't working and removed bug Something isn't working labels Nov 17, 2023
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
* feat: add preRun func to version to restore stdout

Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>

* test: add test to capture version in output

Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>

* change stdout buffering to log to be opt-in per command

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix tests

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
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.

syft version report is broken with 0.97.0 release
3 participants