fix(auth): harden unified diagnostic execution

This commit is contained in:
2026-08-17 16:39:54 +02:00
parent 3ed00ff086
commit 30ee9433dc
20 changed files with 1034 additions and 57 deletions
@@ -0,0 +1,37 @@
//go:build !windows
package compose
import (
"errors"
"os/exec"
"syscall"
"time"
)
const gracefulTerminationBound = 500 * time.Millisecond
const finalTerminationBound = 2 * time.Second
func configureProcess(command *exec.Cmd) {
command.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
}
func terminateProcess(command *exec.Cmd, done <-chan error) error {
if command.Process == nil {
return nil
}
_ = syscall.Kill(-command.Process.Pid, syscall.SIGINT)
select {
case <-done:
return nil
case <-time.After(gracefulTerminationBound):
}
_ = syscall.Kill(-command.Process.Pid, syscall.SIGKILL)
_ = command.Process.Kill()
select {
case <-done:
return nil
case <-time.After(finalTerminationBound):
return errors.New("Docker command could not be reaped")
}
}