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
Shove the original command error in the error tree.
This allows checking for the specific exit code by code like this:
var exitError *exec.ExitError
if errors.As(err, &exitError) {
Added command.FormattedError type to work around issue of not
returning the original exec.ExitError type. The Unwrap() method returns
the original error, so the above example will now work.
returnfmt.Errorf("command failed with exit status %d (%s): %w", exitErr.ExitCode(), c.PrintableCommandArgs(), errors.New(strings.Join(c.errorCollector.errorLines, "\n")))
171
+
errorLines:= []string{}
172
+
ifc.errorCollector!=nil {
173
+
errorLines=c.errorCollector.errorLines
173
174
}
174
-
returnfmt.Errorf("command failed with exit status %d (%s): %w", exitErr.ExitCode(), c.PrintableCommandArgs(), errors.New("check the command's output for details"))
0 commit comments