From 00f17534a3a8b91adec67228642c2005b129a7c6 Mon Sep 17 00:00:00 2001 From: aiordache Date: Wed, 5 Aug 2020 18:02:19 +0200 Subject: [PATCH] error check Signed-off-by: aiordache --- cli/cmd/compose/ps.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/cmd/compose/ps.go b/cli/cmd/compose/ps.go index 55c5a9af8..e5930740b 100644 --- a/cli/cmd/compose/ps.go +++ b/cli/cmd/compose/ps.go @@ -61,17 +61,17 @@ func runPs(ctx context.Context, opts cli.ProjectOptions) error { if err != nil { return err } - printSection(os.Stdout, func(w io.Writer) { + err = printSection(os.Stdout, func(w io.Writer) { for _, service := range serviceList { fmt.Fprintf(w, "%s\t%s\t%d/%d\t%s\n", service.ID, service.Name, service.Replicas, service.Desired, strings.Join(service.Ports, ", ")) } }, "ID", "NAME", "REPLICAS", "PORTS") - return nil + return err } -func printSection(out io.Writer, printer func(io.Writer), headers ...string) { +func printSection(out io.Writer, printer func(io.Writer), headers ...string) error { w := tabwriter.NewWriter(out, 20, 1, 3, ' ', 0) fmt.Fprintln(w, strings.Join(headers, "\t")) printer(w) - w.Flush() + return w.Flush() }