-
Notifications
You must be signed in to change notification settings - Fork 69
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
Use os.Stderr instead of os.Stdout with fmt.Fprintf() #20
base: mainline
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,7 +190,7 @@ func ValidateInputAndStartSession(args []string, out io.Writer) { | |
|
||
//Execute create data channel and start the session | ||
func (s *Session) Execute(log log.T) (err error) { | ||
fmt.Fprintf(os.Stdout, "\nStarting session with SessionId: %s\n", s.SessionId) | ||
fmt.Fprintf(os.Stderr, "\nStarting session with SessionId: %s\n", s.SessionId) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Many just notification messages like these. e.g. Start/stop session, or call out KMS enabled. Not sure changing the behavior to write to Stderr is a better solution. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe a quiet mode to not print those messages There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's better behaviour because it doesn't mix the output with normal output. Say, you call a remote script to generate CSV. Right now you end up with log messages mixed with CSV output. With this change, the log messages go to stderr and aren't mixed with stdout. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, it causes issues like this: https://github.com/zagaran/eb-ssm/pull/4/files#diff-e2c321f9e0a8996da965d12461b0e7d1216893f21adf5fde6cf7366fe288fe55R113 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks all, will test it and support the change in next release. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, just a quick update, we cannot merge this change as plan, since many customer are trying to extract info from the Stdout. e.g. plugin version. This change will break their current user experience. As @tapajos mentioned, we may need a quiet mode, or reduce some logs, change part of them to Stderr. Team will work on resolve this issue in a graceful way later. Thanks for understanding. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LOL, I am in awe of what some people do... yes, please introduce a quiet mode. What is the ETA? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Yangtao-Hua would #94 provide what you need to avoid breaking current user experience? |
||
|
||
// sets the display mode | ||
s.DisplayMode = sessionutil.NewDisplayMode(log) | ||
|
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.
Why are there two
\n
characters here?