-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: silence output when running go test
#88
Conversation
See #87 (comment). |
So my suggestion is to close this PR since the test command in CI usually is |
main_test.go
Outdated
stdout_backup := os.Stdout | ||
stderr_backup := os.Stderr | ||
os.Stdout = nil | ||
os.Stderr = nil | ||
|
||
shell := cmd.NewCommand() | ||
_ = shell.Execute() | ||
|
||
os.Stdout = stdout_backup | ||
os.Stderr = stderr_backup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stdout_backup := os.Stdout | |
stderr_backup := os.Stderr | |
os.Stdout = nil | |
os.Stderr = nil | |
shell := cmd.NewCommand() | |
_ = shell.Execute() | |
os.Stdout = stdout_backup | |
os.Stderr = stderr_backup | |
os.Stdout = nil | |
os.Stderr = nil | |
shell := cmd.NewCommand() | |
_ = shell.Execute() |
Why not keep it simple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a fixup commit: 0369090
Sorry I didn't read the reply in #87 so ignore this comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. See my suggestion to simplify it.
0369090
to
492023e
Compare
This commit fixes the issue where running
go test
would write to stdout. This was caused bycommit 0c94a34.
The solution is just to redirect
stdout
andstderr
tonil
.Solves #87