mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-27 21:33:41 +02:00
* fix(daemon): bound pre-start task preparation Co-authored-by: multica-agent <github@multica.ai> * fix(daemon): isolate pre-start env preparation Run execution-environment Prepare and Reuse in a killable helper process so a timed-out attempt cannot keep writing after retry. Add FIFO lifecycle and squad Stage retry regression coverage. Co-authored-by: multica-agent <github@multica.ai> * fix(daemon): terminate Windows prepare process trees Assign the pre-start helper to a kill-on-close Job Object before releasing its request, wait for all job members to exit on cancellation, and add a Windows runtime regression job. Co-authored-by: multica-agent <github@multica.ai> * ci: target Windows prepare tree regression Co-authored-by: multica-agent <github@multica.ai> --------- Co-authored-by: Bohan-J <bohan@devv.ai> Co-authored-by: multica-agent <github@multica.ai>
40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
//go:build !windows
|
|
|
|
package execenv
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
"os/exec"
|
|
"syscall"
|
|
)
|
|
|
|
type preparationProcessController struct{}
|
|
|
|
func newPreparationProcessController(cmd *exec.Cmd) (*preparationProcessController, error) {
|
|
if cmd.SysProcAttr == nil {
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{}
|
|
}
|
|
cmd.SysProcAttr.Setpgid = true
|
|
return &preparationProcessController{}, nil
|
|
}
|
|
|
|
func (*preparationProcessController) attach(_ *exec.Cmd) error { return nil }
|
|
|
|
func (*preparationProcessController) stop(cmd *exec.Cmd) error {
|
|
if cmd.Process == nil {
|
|
return os.ErrProcessDone
|
|
}
|
|
// Kill the helper and any CLI it spawned. After SIGKILL is pending, a
|
|
// helper blocked in a kernel filesystem call cannot return to Go and
|
|
// perform another write when that call eventually unblocks.
|
|
err := syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
|
|
if errors.Is(err, syscall.ESRCH) {
|
|
return nil
|
|
}
|
|
return err
|
|
}
|
|
|
|
func (*preparationProcessController) finish() error { return nil }
|
|
func (*preparationProcessController) close() {}
|