Audit of 9af1463
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user