diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-09-07 15:32:50 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-09-13 10:33:14 +0200 |
commit | 43f7bdf8229ee04ab17fcf53cf302c5d98d11f8e (patch) | |
tree | 2b4558ab7c7bb9777c559c01558cf7ca31f431c3 | |
parent | 00240a0e2e1f031926fd7f21d9ef5b0d27335e47 (diff) | |
download | podman-43f7bdf8229ee04ab17fcf53cf302c5d98d11f8e.tar.gz podman-43f7bdf8229ee04ab17fcf53cf302c5d98d11f8e.tar.bz2 podman-43f7bdf8229ee04ab17fcf53cf302c5d98d11f8e.zip |
podman inspect return exit code > 0 on print error
Unlikely to happen but when there is an error printing the data to
stdout (either as json or go template) we should not just log it and
exit with 0. Instead return a proper error and exit with 125.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
-rw-r--r-- | cmd/podman/inspect/inspect.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/cmd/podman/inspect/inspect.go b/cmd/podman/inspect/inspect.go index 4e229c43c..22b2c9055 100644 --- a/cmd/podman/inspect/inspect.go +++ b/cmd/podman/inspect/inspect.go @@ -15,7 +15,6 @@ import ( "github.com/containers/podman/v4/cmd/podman/registry" "github.com/containers/podman/v4/cmd/podman/validate" "github.com/containers/podman/v4/pkg/domain/entities" - "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -186,7 +185,7 @@ func (i *inspector) inspect(namesOrIDs []string) error { err = rpt.Execute(data) } if err != nil { - logrus.Errorf("Printing inspect output: %v", err) + errs = append(errs, fmt.Errorf("printing inspect output: %w", err)) } if len(errs) > 0 { |