Skip to content

Commit

Permalink
podman inspect return exit code > 0 on print error
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Luap99 committed Sep 7, 2022
1 parent d130bff commit beae4d7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cmd/podman/inspect/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/containers/podman/v4/cmd/podman/validate"
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -210,7 +209,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 {
Expand Down

0 comments on commit beae4d7

Please sign in to comment.