Skip to content

Commit ce5729c

Browse files
authored
Merge pull request #1130 from sunshineplan/master
v3/process (Win): fix Kill() DuplicateHandle error
2 parents f8cc3bd + 785e379 commit ce5729c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

v3/process/process_windows.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,10 @@ func (p *Process) TerminateWithContext(ctx context.Context) error {
650650
}
651651

652652
func (p *Process) KillWithContext(ctx context.Context) error {
653-
process := os.Process{Pid: int(p.Pid)}
653+
process, err := os.FindProcess(int(p.Pid))
654+
if err != nil {
655+
return err
656+
}
654657
return process.Kill()
655658
}
656659

0 commit comments

Comments
 (0)