diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podmanV2/containers/run.go | 3 | ||||
-rw-r--r-- | cmd/podmanV2/images/list.go | 14 |
2 files changed, 13 insertions, 4 deletions
diff --git a/cmd/podmanV2/containers/run.go b/cmd/podmanV2/containers/run.go index 5c0069afc..f839c358d 100644 --- a/cmd/podmanV2/containers/run.go +++ b/cmd/podmanV2/containers/run.go @@ -109,13 +109,14 @@ func run(cmd *cobra.Command, args []string) error { } runOpts.Spec = s report, err := registry.ContainerEngine().ContainerRun(registry.GetContext(), runOpts) + // report.ExitCode is set by ContainerRun even it it returns an error + registry.SetExitCode(report.ExitCode) if err != nil { return err } if cliVals.Detach { fmt.Println(report.Id) } - registry.SetExitCode(report.ExitCode) if runRmi { _, err := registry.ImageEngine().Delete(registry.GetContext(), []string{report.Id}, entities.ImageDeleteOptions{}) if err != nil { diff --git a/cmd/podmanV2/images/list.go b/cmd/podmanV2/images/list.go index 2d6cb3596..6b02e239e 100644 --- a/cmd/podmanV2/images/list.go +++ b/cmd/podmanV2/images/list.go @@ -130,6 +130,9 @@ func writeJSON(imageS []*entities.ImageSummary) error { } func writeTemplate(imageS []*entities.ImageSummary, err error) error { + var ( + hdr, row string + ) type image struct { entities.ImageSummary Repository string `json:"repository,omitempty"` @@ -148,10 +151,15 @@ func writeTemplate(imageS []*entities.ImageSummary, err error) error { listFlag.readOnly = true } } - - hdr, row := imageListFormat(listFlag) + if len(listFlag.format) < 1 { + hdr, row = imageListFormat(listFlag) + } else { + row = listFlag.format + if !strings.HasSuffix(row, "\n") { + row += "\n" + } + } format := hdr + "{{range . }}" + row + "{{end}}" - tmpl := template.Must(template.New("list").Funcs(report.PodmanTemplateFuncs()).Parse(format)) w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0) defer w.Flush() |