Skip to content
Permalink
Browse files

Remove heading in ps output using arg

  • Loading branch information...
cjbassi committed May 16, 2018
1 parent a65523d commit 0647a4b43353aa5d4b8ed4ab187154aec8e58dcd
Showing with 2 additions and 2 deletions.
  1. +2 −2 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)

0 comments on commit 0647a4b

Please sign in to comment.
You can’t perform that action at this time.