mirror of
https://github.com/coder/coder.git
synced 2026-06-03 21:18:24 +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.
24 lines
649 B
Go
24 lines
649 B
Go
package agentssh
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"syscall"
|
|
|
|
"cdr.dev/slog/v3"
|
|
)
|
|
|
|
func cmdSysProcAttr() *syscall.SysProcAttr {
|
|
return &syscall.SysProcAttr{}
|
|
}
|
|
|
|
func cmdCancel(logger slog.Logger, p *os.Process) error {
|
|
logger.Debug(context.Background(), "cmdCancel: killing process", slog.F("pid", p.Pid))
|
|
// Windows doesn't support sending signals to process groups, so we
|
|
// have to kill the process directly. In the future, we may want to
|
|
// implement a more sophisticated solution for process groups on
|
|
// Windows, but for now, this is a simple way to ensure that the
|
|
// process is terminated when the context is cancelled.
|
|
return p.Kill()
|
|
}
|