cleanup ps.go

The code is called in both cases so remove the duplicate one.

Signed-off-by: Hushan Jia <hushan.jia@gmail.com>
This commit is contained in:
Hushan Jia 2016-06-06 02:17:44 +08:00
parent afaa21f79a
commit 772505aa24
1 changed files with 5 additions and 8 deletions

13
ps.go
View File

@ -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 {