From 7a9075437733caf62317dca42fdcb98e839d3acf Mon Sep 17 00:00:00 2001 From: Mike Sawka Date: Thu, 24 Oct 2024 16:07:18 -0700 Subject: [PATCH] fix shutdown logic for macos/linux (#1128) --- pkg/shellexec/conninterface.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/shellexec/conninterface.go b/pkg/shellexec/conninterface.go index e601f8e1d..96670e2fa 100644 --- a/pkg/shellexec/conninterface.go +++ b/pkg/shellexec/conninterface.go @@ -4,6 +4,8 @@ import ( "io" "os" "os/exec" + "runtime" + "syscall" "time" "github.com/creack/pty" @@ -42,7 +44,11 @@ func (cw CmdWrap) KillGraceful(timeout time.Duration) { if cw.Cmd.ProcessState != nil && cw.Cmd.ProcessState.Exited() { return } - cw.Cmd.Process.Signal(os.Interrupt) + if runtime.GOOS == "windows" { + cw.Cmd.Process.Signal(os.Interrupt) + } else { + cw.Cmd.Process.Signal(syscall.SIGTERM) + } go func() { time.Sleep(timeout) if cw.Cmd.ProcessState == nil || !cw.Cmd.ProcessState.Exited() {