Modules affected
shell
[BACKWARDS INCOMPATIBLE CHANGE]
Description
Updated the shell
package to wrap errors with ErrWithCmdOutput
so that (a) instead of an unhelpful "FatalError{Underlying: exit status 1}"
error message, you now see the stderr
output in the error message and (b) you can now programmatically retrieve the stderr
stream from errors too.
Migration guide
For most use cases, no changes will be necessary; you'll just get clearer error messages!
However, if you were programmatically using the error
returned from shell
commands, the type of the error
returned and the message within are now different. You can get back the original, underlying error as follows:
err := RunCommandE(t, cmd)
if err != nil {
errWithOutput, isErrWithOutput := err.(shell.ErrWithCmdOutput)
if isErrWithOutput {
// Get the original, underlying error
underlying = errWithOutput.Underlying
}
}
Special thanks
Special thanks to @tommyknows for the contribution!