Skip to content

Commit

Permalink
Fix windows compile errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxserxxx committed Jun 21, 2020
1 parent b49c7c9 commit 81424fb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ github.com/distatus/battery v0.9.0 h1:8NS5o00/j3Oh2xgocA6pQROTp5guoR+s8CZlWzHC4Q
github.com/distatus/battery v0.9.0/go.mod h1:gGO7GxHTi1zlRT+cAj8uGG0/8HFiqAeH0TJvoipnuPs=
github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc=
github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmyFlkYTrY=
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
Expand Down
20 changes: 15 additions & 5 deletions widgets/proc_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package widgets
import (
"fmt"
"log"
"strconv"

psProc "github.com/shirou/gopsutil/process"
"github.com/shirou/gopsutil/process"
)

func getProcs() ([]Proc, error) {
psProcs, err := psProc.Processes()
psProcs, err := process.Processes()
if err != nil {
return nil, fmt.Errorf(tr.Value("widget.proc.err.gopsutil", err.Error()))
}
Expand All @@ -18,15 +19,24 @@ func getProcs() ([]Proc, error) {
pid := psProc.Pid
command, err := psProc.Name()
if err != nil {
log.Println(tr.Value("widget.proc.err.getcmd", err, psProc, i, pid))
sps := fmt.Sprintf("%v", psProc)
si := strconv.Itoa(i)
spid := fmt.Sprintf("%d", pid)
log.Println(tr.Value("widget.proc.err.getcmd", err.Error(), sps, si, spid))
}
cpu, err := psProc.CPUPercent()
if err != nil {
log.Println(tr.Value("widget.proc.err.cpupercent", err, psProc, i, pid))
sps := fmt.Sprintf("%v", psProc)
si := strconv.Itoa(i)
spid := fmt.Sprintf("%d", pid)
log.Println(tr.Value("widget.proc.err.cpupercent", err.Error(), sps, si, spid))
}
mem, err := psProc.MemoryPercent()
if err != nil {
log.Println(tr.Value("widget.proc.err.mempercent", err, psProc, i, pid))
sps := fmt.Sprintf("%v", psProc)
si := strconv.Itoa(i)
spid := fmt.Sprintf("%d", pid)
log.Println(tr.Value("widget.proc.err.mempercent", err.Error(), sps, si, spid))
}

procs[i] = Proc{
Expand Down

0 comments on commit 81424fb

Please sign in to comment.