diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/xdsserver/terminal-ssh.go | 6 | ||||
-rw-r--r-- | lib/xsapiv1/targets.go | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/xdsserver/terminal-ssh.go b/lib/xdsserver/terminal-ssh.go index c275173..fcef4f9 100644 --- a/lib/xdsserver/terminal-ssh.go +++ b/lib/xdsserver/terminal-ssh.go @@ -223,13 +223,15 @@ func (t *TermSSH) Open(sock *socketio.Socket, sessID string) (*xsapiv1.TerminalC // Close a terminal func (t *TermSSH) Close() (*xsapiv1.TerminalConfig, error) { - // nothing to do when not open - if t.termCfg.Status != xsapiv1.StatusTermOpen { + // nothing to do when not open or closing + if ! (t.termCfg.Status == xsapiv1.StatusTermOpen || t.termCfg.Status == xsapiv1.StatusTermClosing) { return &t.termCfg, nil } err := t.sshWS.Signal("SIGTERM") + t.termCfg.Status = xsapiv1.StatusTermClosing + return &t.termCfg, err } diff --git a/lib/xsapiv1/targets.go b/lib/xsapiv1/targets.go index 793724a..bae36f9 100644 --- a/lib/xsapiv1/targets.go +++ b/lib/xsapiv1/targets.go @@ -65,6 +65,8 @@ const ( StatusTermOpen = "Open" // StatusTermClose Close state StatusTermClose = "Close" + // StatusTermClosing Closing state + StatusTermClosing = "Closing" // TerminalInEvent Event send in WS when characters are sent (stdin) TerminalInEvent = "term:input" |