diff options
author | Caleb Bassi <calebjbassi@gmail.com> | 2018-05-15 20:21:25 -0700 |
---|---|---|
committer | Caleb Bassi <calebjbassi@gmail.com> | 2018-05-15 20:21:25 -0700 |
commit | 0647a4b43353aa5d4b8ed4ab187154aec8e58dcd (patch) | |
tree | 3223a3ec0d0747be1b66ac8f3a953a39e58363e5 | |
parent | a65523dab62a66efb591761eb6d82bdb17ba3a98 (diff) |
Remove heading in ps output using arg
-rw-r--r-- | src/widgets/proc_unix.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/proc_unix.go b/src/widgets/proc_unix.go index dd60a6e..f49b6e2 100644 --- a/src/widgets/proc_unix.go +++ b/src/widgets/proc_unix.go @@ -22,10 +22,10 @@ func (self *Proc) update() { } func Processes() []Process { - output, _ := exec.Command("ps", "-acxo", "pid,comm,pcpu,pmem").Output() + output, _ := exec.Command("ps", "--no-headers", "-acxo", "pid,comm,pcpu,pmem").Output() strOutput := strings.TrimSpace(string(output)) processes := []Process{} - for _, line := range strings.Split(strOutput, "\n")[1:] { + for _, line := range strings.Split(strOutput, "\n") { split := strings.Fields(line) pid, _ := strconv.Atoi(split[0]) cpu, _ := strconv.ParseFloat(split[2], 64) |