diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index 58afbf98..bce6ec43 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -5,6 +5,7 @@ import ( "io" "os" "os/exec" + "runtime" ) func SysDaemon() error { @@ -19,5 +20,11 @@ func SysDaemon() error { cmd := exec.CommandContext(ctx, os.Args[2], os.Args[3:]...) cmd.Stderr = os.Stderr cmd.Stdout = os.Stdout + cmd.Cancel = func() error { + if runtime.GOOS == "windows" { + return cmd.Process.Kill() + } + return cmd.Process.Signal(os.Interrupt) + } return cmd.Run() }