Add json format to ps command

For programatic parsing add a json format option to the new `runc ps`
command.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2016-04-25 15:21:07 -07:00
parent e559f7aebb
commit bb8591138b
2 changed files with 26 additions and 4 deletions
+1 -4
View File
@@ -81,12 +81,9 @@ in json format:
fatal(err)
}
case "json":
data, err := json.Marshal(s)
if err != nil {
if err := json.NewEncoder(os.Stdout).Encode(s); err != nil {
fatal(err)
}
os.Stdout.Write(data)
default:
fatalf("invalid format option")
}