status in return TerminalConfig is still opened when a term is closed
Change-Id: Idacb67607ca32bfe35738d86e784512cb7758b02
Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
// 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
}
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"