fix(tasks): fix task cancellation process tree leak, emit cancelled events, and refine status badges styling

This commit is contained in:
duorameng
2026-06-29 22:34:08 +08:00
parent e5fc716b8f
commit b52af6c4fd
10 changed files with 132 additions and 73 deletions
+21
View File
@@ -0,0 +1,21 @@
//go:build !windows
package executor
import (
"os/exec"
"syscall"
)
func SetProcessGroupAndCancel(cmd *exec.Cmd, usePty bool) {
if !usePty {
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
}
cmd.Cancel = func() error {
if cmd.Process != nil {
// Kill the entire process group by sending SIGKILL to negative PID
return syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
}
return nil
}
}