1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-05-10 19:29:14 +08:00

Merge pull request #1130 from sunshineplan/master

v3/process (Win): fix Kill() DuplicateHandle error
This commit is contained in:
shirou 2021-09-11 11:11:55 +09:00 committed by GitHub
commit ce5729cbcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -650,7 +650,10 @@ func (p *Process) TerminateWithContext(ctx context.Context) error {
}
func (p *Process) KillWithContext(ctx context.Context) error {
process := os.Process{Pid: int(p.Pid)}
process, err := os.FindProcess(int(p.Pid))
if err != nil {
return err
}
return process.Kill()
}