mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-09-22 09:20:58 +02:00
feat: manage task process lifetimes and preserve turn history
This commit is contained in:
@@ -39,3 +39,14 @@ func terminateProcessGroup(rootPID int, cmd *exec.Cmd) {
|
||||
func terminateCmdTree(cmd *exec.Cmd) {
|
||||
terminateProcessGroup(0, cmd)
|
||||
}
|
||||
|
||||
// stopProcessGroup gives the whole job a grace period to release resources.
|
||||
func stopProcessGroup(pid int, cmd *exec.Cmd) {
|
||||
if pid > 0 {
|
||||
_ = syscall.Kill(-pid, syscall.SIGTERM)
|
||||
}
|
||||
}
|
||||
|
||||
func processGroupExists(pid int) bool {
|
||||
return pid > 0 && syscall.Kill(-pid, 0) != syscall.ESRCH
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user