Skip to content

Commit

Permalink
add PPID to the output
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyll committed Sep 5, 2017
1 parent 08cb239 commit f0a29dc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand All @@ -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 {
Expand Down

0 comments on commit f0a29dc

Please sign in to comment.