mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
fix shutdown logic for macos/linux (#1128)
This commit is contained in:
parent
2f5c4a6da7
commit
7a90754377
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user