You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After stumbling upon OutOrStdout and OutOrStderr, I thought they'd be great for testing purposes. From my command I would get stdout / stderr writers by calling them and in tests I could just inject some bytes.Buffer to assert on outputs.
However there is a single SetOutput in the Command, which has the following comment : SetOutput sets the destination for usage and error messages. So I assume this refers to stderr.
After stumbling upon
OutOrStdout
andOutOrStderr
, I thought they'd be great for testing purposes. From my command I would get stdout / stderr writers by calling them and in tests I could just inject somebytes.Buffer
to assert on outputs.However there is a single
SetOutput
in the Command, which has the following comment :SetOutput sets the destination for usage and error messages.
So I assume this refers to stderr.Would you consider allowing two writers there?
Some others also seem to be bit by this, in kubectl for example they have to pass the 2 writers explicitly (to properly test command outputs I assume) : https://github.com/kubernetes/kubernetes/blob/e00a60283f87db1bd8db0b80bec622353cf88f96/pkg/kubectl/cmd/auth/cani.go#L84
The text was updated successfully, but these errors were encountered: