Skip to content

Commit

Permalink
Merge pull request #610 from StrongMonkey/fix-signlre
Browse files Browse the repository at this point in the history
Fix: Try to send interupt to sys.daemon to allow cleanup
  • Loading branch information
StrongMonkey authored Jul 3, 2024
2 parents 753f5aa + 1104843 commit 823142b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io"
"os"
"os/exec"
"runtime"
)

func SysDaemon() error {
Expand All @@ -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()
}

0 comments on commit 823142b

Please sign in to comment.