1
0
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:
Alexander Inozemtsev 2016-03-02 18:19:52 +03:00
parent 1de1357e77
commit f4902fae49

View File

@ -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
}