Skip to content

Commit daef472

Browse files
authored
Merge pull request #614 from gptscript-ai/revert-611-revert-1
Un-revert "Fix: Try to send interupt to sys.daemon to allow cleanup""
2 parents 89c29a5 + e7193ad commit daef472

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/daemon/daemon.go

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"io"
66
"os"
77
"os/exec"
8+
"runtime"
89
)
910

1011
func SysDaemon() error {
@@ -19,5 +20,11 @@ func SysDaemon() error {
1920
cmd := exec.CommandContext(ctx, os.Args[2], os.Args[3:]...)
2021
cmd.Stderr = os.Stderr
2122
cmd.Stdout = os.Stdout
23+
cmd.Cancel = func() error {
24+
if runtime.GOOS == "windows" {
25+
return cmd.Process.Kill()
26+
}
27+
return cmd.Process.Signal(os.Interrupt)
28+
}
2229
return cmd.Run()
2330
}

0 commit comments

Comments
 (0)