cmd/docker: do not print error status on exec/run
Co-authored-by: Fabio Pugliese Ornellas <fabio.ornellas@gmail.com> Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
This commit is contained in:
co-authored by
Fabio Pugliese Ornellas
parent
eb48cad302
commit
0cff340983
@@ -3,6 +3,7 @@ package network
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/docker/cli/cli"
|
||||
"github.com/docker/cli/cli/command"
|
||||
@@ -68,7 +69,7 @@ func runRemove(ctx context.Context, dockerCLI command.Cli, networks []string, op
|
||||
}
|
||||
|
||||
if status != 0 {
|
||||
return cli.StatusError{StatusCode: status}
|
||||
return cli.StatusError{StatusCode: status, Status: "exit status " + strconv.Itoa(status)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+3
-5
@@ -1,9 +1,5 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// StatusError reports an unsuccessful exit by a command.
|
||||
type StatusError struct {
|
||||
Cause error
|
||||
@@ -21,7 +17,9 @@ func (e StatusError) Error() string {
|
||||
if e.Cause != nil {
|
||||
return e.Cause.Error()
|
||||
}
|
||||
return "exit status " + strconv.Itoa(e.StatusCode)
|
||||
// we don't want to set a default message here,
|
||||
// some commands might want to be explicit about the error message
|
||||
return ""
|
||||
}
|
||||
|
||||
func (e StatusError) Unwrap() error {
|
||||
|
||||
Reference in New Issue
Block a user