Skip to content

Commit c628ccc

Browse files
thdxropencode
andcommitted
fix: add Windows-specific process termination in Kill function
Use process.Kill() on Windows instead of SIGTERM signal for proper cross-platform process termination support. 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode <noreply@opencode.ai>
1 parent 1ed8d9c commit c628ccc

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

pkg/process/process.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"log/slog"
66
"os"
77
"os/exec"
8+
"runtime"
89
"sync"
910
"syscall"
1011
"time"
@@ -97,9 +98,20 @@ func Kill(process *os.Process) error {
9798
}
9899
slog.Info("killing process", "pid", process.Pid)
99100

100-
if err := process.Signal(syscall.SIGTERM); err != nil {
101-
slog.Error("failed to send sigterm", "pid", process.Pid)
102-
return err
101+
switch runtime.GOOS {
102+
103+
case "windows":
104+
if err := process.Kill(); err != nil {
105+
slog.Error("failed to kill", "pid", process.Pid)
106+
return err
107+
}
108+
break
109+
110+
default:
111+
if err := process.Signal(syscall.SIGTERM); err != nil {
112+
slog.Error("failed to send sigterm", "pid", process.Pid)
113+
return err
114+
}
103115
}
104116

105117
done := make(chan struct{})

0 commit comments

Comments
 (0)