Fix windows compile errors.
This commit is contained in:
parent
b49c7c9a60
commit
81424fb000
1
go.sum
1
go.sum
|
@ -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=
|
||||
|
|
|
@ -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()))
|
||||
}
|
||||
|
@ -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{
|
||||
|
|
Loading…
Reference in New Issue
Block a user