mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-26 13:48:59 +08:00
Properly close opened file
This commit is contained in:
parent
1de1357e77
commit
f4902fae49
@ -70,7 +70,8 @@ func NewProcess(pid int32) (*Process, error) {
|
||||
p := &Process{
|
||||
Pid: int32(pid),
|
||||
}
|
||||
_, err := os.Open(common.HostProc(strconv.Itoa(int(p.Pid))))
|
||||
file, err := os.Open(common.HostProc(strconv.Itoa(int(p.Pid))))
|
||||
defer file.Close()
|
||||
return p, err
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user