+
A GitHub star shows your support for Wave (and open-source) and helps us reach more
developers.
diff --git a/package-lock.json b/package-lock.json
index 28662b7ec3..9805bd73d8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "waveterm",
- "version": "0.13.2-alpha.2",
+ "version": "0.14.0-beta.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "waveterm",
- "version": "0.13.2-alpha.2",
+ "version": "0.14.0-beta.0",
"hasInstallScript": true,
"license": "Apache-2.0",
"workspaces": [
diff --git a/pkg/shellexec/conninterface.go b/pkg/shellexec/conninterface.go
index f7fae7602e..1ef93097bb 100644
--- a/pkg/shellexec/conninterface.go
+++ b/pkg/shellexec/conninterface.go
@@ -35,14 +35,16 @@ type ConnInterface interface {
type CmdWrap struct {
Cmd *exec.Cmd
+ IsShell bool
WaitOnce *sync.Once
WaitErr error
pty.Pty
}
-func MakeCmdWrap(cmd *exec.Cmd, cmdPty pty.Pty) CmdWrap {
+func MakeCmdWrap(cmd *exec.Cmd, cmdPty pty.Pty, isShell bool) CmdWrap {
return CmdWrap{
Cmd: cmd,
+ IsShell: isShell,
WaitOnce: &sync.Once{},
Pty: cmdPty,
}
@@ -90,6 +92,8 @@ func (cw CmdWrap) KillGraceful(timeout time.Duration) {
}
if runtime.GOOS == "windows" {
cw.Cmd.Process.Signal(os.Interrupt)
+ } else if cw.IsShell {
+ syscall.Kill(cw.Cmd.Process.Pid, syscall.SIGHUP)
} else {
cw.Cmd.Process.Signal(syscall.SIGTERM)
}
diff --git a/pkg/shellexec/shellexec.go b/pkg/shellexec/shellexec.go
index 957c09e226..4850eee1b8 100644
--- a/pkg/shellexec/shellexec.go
+++ b/pkg/shellexec/shellexec.go
@@ -169,7 +169,7 @@ func StartWslShellProcNoWsh(ctx context.Context, termSize waveobj.TermSize, cmdS
if err != nil {
return nil, err
}
- cmdWrap := MakeCmdWrap(ecmd, cmdPty)
+ cmdWrap := MakeCmdWrap(ecmd, cmdPty, true)
return &ShellProc{Cmd: cmdWrap, ConnName: conn.GetName(), CloseOnce: &sync.Once{}, DoneCh: make(chan any)}, nil
}
@@ -287,7 +287,7 @@ func StartWslShellProc(ctx context.Context, termSize waveobj.TermSize, cmdStr st
if err != nil {
return nil, err
}
- cmdWrap := MakeCmdWrap(ecmd, cmdPty)
+ cmdWrap := MakeCmdWrap(ecmd, cmdPty, true)
return &ShellProc{Cmd: cmdWrap, ConnName: conn.GetName(), CloseOnce: &sync.Once{}, DoneCh: make(chan any)}, nil
}
@@ -593,7 +593,9 @@ func StartLocalShellProc(logCtx context.Context, termSize waveobj.TermSize, cmdS
}
shellType := shellutil.GetShellTypeFromShellPath(shellPath)
shellOpts = append(shellOpts, cmdOpts.ShellOpts...)
+ var isShell bool
if cmdStr == "" {
+ isShell = true
if shellType == shellutil.ShellType_bash {
// add --rcfile
// cant set -l or -i with --rcfile
@@ -622,6 +624,7 @@ func StartLocalShellProc(logCtx context.Context, termSize waveobj.TermSize, cmdS
shellutil.UpdateCmdEnv(ecmd, map[string]string{"ZDOTDIR": shellutil.GetLocalZshZDotDir()})
}
} else {
+ isShell = false
shellOpts = append(shellOpts, "-c", cmdStr)
ecmd = exec.Command(shellPath, shellOpts...)
ecmd.Env = os.Environ()
@@ -685,7 +688,7 @@ func StartLocalShellProc(logCtx context.Context, termSize waveobj.TermSize, cmdS
if err != nil {
return nil, err
}
- cmdWrap := MakeCmdWrap(ecmd, cmdPty)
+ cmdWrap := MakeCmdWrap(ecmd, cmdPty, isShell)
return &ShellProc{Cmd: cmdWrap, ConnName: connName, CloseOnce: &sync.Once{}, DoneCh: make(chan any)}, nil
}