Skip to content

Commit 7a90754

Browse files
authored
fix shutdown logic for macos/linux (#1128)
1 parent 2f5c4a6 commit 7a90754

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/shellexec/conninterface.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"io"
55
"os"
66
"os/exec"
7+
"runtime"
8+
"syscall"
79
"time"
810

911
"github.com/creack/pty"
@@ -42,7 +44,11 @@ func (cw CmdWrap) KillGraceful(timeout time.Duration) {
4244
if cw.Cmd.ProcessState != nil && cw.Cmd.ProcessState.Exited() {
4345
return
4446
}
45-
cw.Cmd.Process.Signal(os.Interrupt)
47+
if runtime.GOOS == "windows" {
48+
cw.Cmd.Process.Signal(os.Interrupt)
49+
} else {
50+
cw.Cmd.Process.Signal(syscall.SIGTERM)
51+
}
4652
go func() {
4753
time.Sleep(timeout)
4854
if cw.Cmd.ProcessState == nil || !cw.Cmd.ProcessState.Exited() {

0 commit comments

Comments
 (0)