Skip to content

Commit c329f8b

Browse files
authored
Merge pull request #5
* Use OS-specific signal for task cancellation
1 parent 53db2ee commit c329f8b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"io"
1313
"os"
1414
"os/exec"
15+
"runtime"
1516
"slices"
1617
"strings"
1718
"syscall"
@@ -214,7 +215,11 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
214215
return m, nil
215216
case "ctrl+x":
216217
if m.taskRunning {
217-
err := syscall.Kill(-m.command.Process.Pid, syscall.SIGINT)
218+
sig := syscall.SIGINT
219+
if runtime.GOOS == "windows" {
220+
sig = syscall.SIGKILL
221+
}
222+
err := syscall.Kill(-m.command.Process.Pid, sig)
218223
if err != nil {
219224
m.appendErrorMsg("Error cancelling task: " + err.Error())
220225
return m, nil

0 commit comments

Comments
 (0)