Files
coder/agent/agentscripts/agentscripts_windows.go
Cian Johnston e8e16c9404 chore(agent/agentscripts): log command cancellation (#16324)
Relates to https://github.com/coder/internal/issues/329

It's currently unclear where the SIGHUP came from; adding some logging
to make it more clear if it happens again in future.

---------

Co-authored-by: Danny Kopping <danny@coder.com>
2025-01-29 13:37:43 +00:00

22 lines
420 B
Go

package agentscripts
import (
"context"
"os"
"os/exec"
"syscall"
"cdr.dev/slog"
)
func cmdSysProcAttr() *syscall.SysProcAttr {
return &syscall.SysProcAttr{}
}
func cmdCancel(ctx context.Context, logger slog.Logger, cmd *exec.Cmd) func() error {
return func() error {
logger.Debug(ctx, "cmdCancel: sending interrupt to process", slog.F("pid", cmd.Process.Pid))
return cmd.Process.Signal(os.Interrupt)
}
}