summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-09-07 15:32:50 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-09-13 10:33:14 +0200
commit43f7bdf8229ee04ab17fcf53cf302c5d98d11f8e (patch)
tree2b4558ab7c7bb9777c559c01558cf7ca31f431c3
parent00240a0e2e1f031926fd7f21d9ef5b0d27335e47 (diff)
downloadpodman-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.go3
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 {