From f0a29dc24429fd27346a1318d9fb049e4f38924e Mon Sep 17 00:00:00 2001 From: Jaana Burcu Dogan Date: Mon, 4 Sep 2017 18:49:17 -0700 Subject: [PATCH] add PPID to the output --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 1725e08..214bac2 100644 --- a/main.go +++ b/main.go @@ -68,9 +68,10 @@ func main() { func processes() { ps := goprocess.FindAll() - var maxPID, maxExec, maxVersion int + var maxPID, maxPPID, maxExec, maxVersion int for _, p := range ps { maxPID = max(maxPID, len(strconv.Itoa(p.PID))) + maxPPID = max(maxPPID, len(strconv.Itoa(p.PPID))) maxExec = max(maxExec, len(p.Exec)) maxVersion = max(maxVersion, len(p.BuildVersion)) } @@ -79,6 +80,9 @@ func processes() { buf := bytes.NewBuffer(nil) pid := strconv.Itoa(p.PID) fmt.Fprint(buf, pad(pid, maxPID)) + fmt.Fprint(buf, " ") + ppid := strconv.Itoa(p.PPID) + fmt.Fprint(buf, pad(ppid, maxPPID)) if p.Agent { fmt.Fprint(buf, "*") } else {