From 43f7bdf8229ee04ab17fcf53cf302c5d98d11f8e Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Wed, 7 Sep 2022 15:32:50 +0200 Subject: 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 --- cmd/podman/inspect/inspect.go | 3 +-- 1 file changed, 1 insertion(+), 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 { -- cgit v1.2.3-54-g00ecf