This commit is contained in:
Ian Gulliver
2026-10-20 22:49:11 -07:00
parent 4f7d05021a
commit 99401670ee
7 changed files with 53 additions and 40 deletions
+5 -6
View File
@@ -13,7 +13,6 @@ import (
"net"
"net/http"
"os"
"os/exec"
"path/filepath"
"strings"
"sync"
@@ -22,6 +21,7 @@ import (
"time"
"g.fc.run/ai/byre/internal/mcp"
"g.fc.run/ai/byre/internal/procgroup"
)
const maxRuleBytes = 24000
@@ -115,7 +115,7 @@ func (e Event) Result() (Result, error) {
}
type proc struct {
cmd *exec.Cmd
cmd *procgroup.Cmd
stdin io.WriteCloser
done chan struct{}
expected bool
@@ -324,7 +324,7 @@ func (s *Session) spawnLocked() error {
}
args = append(args, "--print", "")
cmd := exec.Command("agy", args...)
cmd := procgroup.Command("agy", args...)
cmd.Dir = s.opts.Cwd
cmd.Stderr = os.Stderr
cmd.Env = append(os.Environ(),
@@ -334,7 +334,6 @@ func (s *Session) spawnLocked() error {
"GIT_COMMITTER_EMAIL="+s.opts.GitEmail,
)
cmd.Env = append(cmd.Env, s.opts.Env...)
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
stdin, err := cmd.StdinPipe()
if err != nil {
@@ -429,7 +428,7 @@ func (s *Session) restartLocked() error {
select {
case <-p.done:
case <-time.After(10 * time.Second):
syscall.Kill(-p.cmd.Process.Pid, syscall.SIGKILL)
p.cmd.Kill()
<-p.done
}
return s.spawnLocked()
@@ -568,7 +567,7 @@ func (s *Session) Kill() {
s.mu.Unlock()
if p != nil {
syscall.Kill(-p.cmd.Process.Pid, syscall.SIGKILL)
p.cmd.Kill()
<-p.done
}
s.die()