mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-03-11 13:23:06 +01:00
fix shutdown logic for macos/linux (#1128)
This commit is contained in:
parent
2f5c4a6da7
commit
7a90754377
@ -4,6 +4,8 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/creack/pty"
|
"github.com/creack/pty"
|
||||||
@ -42,7 +44,11 @@ func (cw CmdWrap) KillGraceful(timeout time.Duration) {
|
|||||||
if cw.Cmd.ProcessState != nil && cw.Cmd.ProcessState.Exited() {
|
if cw.Cmd.ProcessState != nil && cw.Cmd.ProcessState.Exited() {
|
||||||
return
|
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() {
|
go func() {
|
||||||
time.Sleep(timeout)
|
time.Sleep(timeout)
|
||||||
if cw.Cmd.ProcessState == nil || !cw.Cmd.ProcessState.Exited() {
|
if cw.Cmd.ProcessState == nil || !cw.Cmd.ProcessState.Exited() {
|
||||||
|
Loading…
Reference in New Issue
Block a user