mirror of
https://github.com/coder/coder.git
synced 2026-06-03 04:58:23 +00:00
49b34a716a
Upgrades to slog v3 which includes a small, but backward incompatible API change to the acceptible call arguments when logging. This change allows us to verify via compile time type checking that arguments are correct and won't cause a panic, as was possible in slog v1, which this replaces (v2 was tagged but never used in coder/coder). It also updates dependencies that also use slog and were updated. I've left the `aibridge` dependency as a commit SHA, under the assumption that the team there (cc @pawbana @dannykopping ) will tag and update the dependency soon and on their own schedule. Other dependencies, I pushed new tags.
25 lines
480 B
Go
25 lines
480 B
Go
//go:build !windows
|
|
|
|
package agentscripts
|
|
|
|
import (
|
|
"context"
|
|
"os/exec"
|
|
"syscall"
|
|
|
|
"cdr.dev/slog/v3"
|
|
)
|
|
|
|
func cmdSysProcAttr() *syscall.SysProcAttr {
|
|
return &syscall.SysProcAttr{
|
|
Setsid: true,
|
|
}
|
|
}
|
|
|
|
func cmdCancel(ctx context.Context, logger slog.Logger, cmd *exec.Cmd) func() error {
|
|
return func() error {
|
|
logger.Debug(ctx, "cmdCancel: sending SIGHUP to process and children", slog.F("pid", cmd.Process.Pid))
|
|
return syscall.Kill(-cmd.Process.Pid, syscall.SIGHUP)
|
|
}
|
|
}
|