From 772505aa249b712586bec6d71a7a26d2bc0efd3c Mon Sep 17 00:00:00 2001 From: Hushan Jia Date: Mon, 6 Jun 2016 02:17:44 +0800 Subject: [PATCH] cleanup ps.go The code is called in both cases so remove the duplicate one. Signed-off-by: Hushan Jia --- ps.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ps.go b/ps.go index 0b6ed167..87458f3d 100644 --- a/ps.go +++ b/ps.go @@ -30,11 +30,12 @@ var psCommand = cli.Command{ return err } + pids, err := container.Processes() + if err != nil { + return err + } + if context.String("format") == "json" { - pids, err := container.Processes() - if err != nil { - return err - } if err := json.NewEncoder(os.Stdout).Encode(pids); err != nil { return err } @@ -57,10 +58,6 @@ var psCommand = cli.Command{ return err } - pids, err := container.Processes() - if err != nil { - return err - } fmt.Println(lines[0]) for _, line := range lines[1:] { if len(line) == 0 {