Audit of 9af1463
This commit is contained in:
@@ -8,13 +8,12 @@ import (
|
||||
"log/slog"
|
||||
"maps"
|
||||
"os"
|
||||
"os/exec"
|
||||
"slices"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"g.fc.run/ai/byre/internal/api"
|
||||
"g.fc.run/ai/byre/internal/procgroup"
|
||||
)
|
||||
|
||||
const usageTimeout = 10 * time.Second
|
||||
@@ -127,11 +126,7 @@ func runUsageCommand(cmdline string) (api.Usage, error) {
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), usageTimeout)
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(ctx, shell, "-l", "-c", cmdline)
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
cmd.Cancel = func() error {
|
||||
return syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
|
||||
}
|
||||
cmd := procgroup.CommandContext(ctx, shell, "-l", "-c", cmdline)
|
||||
cmd.WaitDelay = time.Second
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user