internal/opencode: runner (idle/hard timeout, process-group kill, resume-fallback) + verdict/json parsing
All checks were successful
build-test / build (push) Successful in 1m21s
All checks were successful
build-test / build (push) Successful in 1m21s
This commit is contained in:
23
internal/opencode/pgid_linux.go
Normal file
23
internal/opencode/pgid_linux.go
Normal file
@@ -0,0 +1,23 @@
|
||||
//go:build linux
|
||||
|
||||
package opencode
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func sysProcAttr(proc *exec.Cmd) {
|
||||
proc.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
}
|
||||
|
||||
// killProcGroup убивает всю process-group по лидеру pid (SIGKILL дочерним и
|
||||
// SIGTERM лидеру). Игнорирует ошибки: weakest-effort teardown.
|
||||
func killProcGroup(pid int) {
|
||||
pgid, err := syscall.Getpgid(pid)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_ = syscall.Kill(-pgid, syscall.SIGKILL)
|
||||
_ = syscall.Kill(pid, syscall.SIGKILL)
|
||||
}
|
||||
Reference in New Issue
Block a user