-
Notifications
You must be signed in to change notification settings - Fork 65
Redirect sqlcmd errors to err stream #143
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
Conversation
@@ -209,6 +209,19 @@ func (s *Sqlcmd) SetError(e io.WriteCloser) { | |||
s.err = e | |||
} | |||
|
|||
// WriteError writes the error on specified stream | |||
func (s *Sqlcmd) WriteError(stream io.Writer, err error) { |
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.
I like the consolidation into this function
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.
🕐
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.
By default sqlcmd uses stdout as the default stream for output and errors.
As a result when the stderr is redirected externally to file, the sqlcmd errors are missed.
This commit logs all the sqlcmd errors to the stderr of OS in case default output
stream is stdout and stderr for sqlcmd is not set.
Resolves #105