@@ -17,7 +17,7 @@ type SysInfo struct {
17
17
Memory float64
18
18
}
19
19
20
- // Stat will store CUP time struct
20
+ // Stat will store CPU time struct
21
21
type Stat struct {
22
22
utime float64
23
23
stime float64
@@ -42,8 +42,7 @@ func wrapper(statType string) func(pid int) (*SysInfo, error) {
42
42
}
43
43
func init () {
44
44
platform = runtime .GOOS
45
- eol = "\n "
46
- if strings .Index (platform , "win" ) == 0 {
45
+ if eol = "\n " ; strings .Index (platform , "win" ) == 0 {
47
46
platform = "win"
48
47
eol = "\r \n "
49
48
}
@@ -79,7 +78,7 @@ func stat(pid int, statType string) (*SysInfo, error) {
79
78
stdout , _ := exec .Command ("ps" , args , strconv .Itoa (pid )).Output ()
80
79
ret := formatStdOut (stdout , 1 )
81
80
if len (ret ) == 0 {
82
- return sysInfo , errors .New ("can not foud this pid : " + strconv .Itoa (pid ))
81
+ return sysInfo , errors .New ("Can't find process with this PID : " + strconv .Itoa (pid ))
83
82
}
84
83
sysInfo .CPU = parseFloat (ret [0 ])
85
84
sysInfo .Memory = parseFloat (ret [1 ]) * 1024
@@ -105,7 +104,7 @@ func stat(pid int, statType string) (*SysInfo, error) {
105
104
splitAfter := strings .SplitAfter (string (procStatFileBytes ), ")" )
106
105
107
106
if len (splitAfter ) == 0 || len (splitAfter ) == 1 {
108
- return sysInfo , errors .New ("can not foud this pid : " + strconv .Itoa (pid ))
107
+ return sysInfo , errors .New ("Can't find process with this PID : " + strconv .Itoa (pid ))
109
108
}
110
109
infos := strings .Split (splitAfter [1 ], " " )
111
110
stat := & Stat {
0 commit comments