mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-30 18:56:20 +08:00
fix: Fix the problem that the terminal exit fails (#8189)
Some checks failed
SonarCloud Scan / SonarCloud (push) Failing after -28s
Some checks failed
SonarCloud Scan / SonarCloud (push) Failing after -28s
This commit is contained in:
parent
99775e1eb4
commit
79eb0288b4
3 changed files with 12 additions and 10 deletions
|
|
@ -68,9 +68,8 @@ func (b *BaseApi) WsSsh(c *gin.Context) {
|
|||
|
||||
<-quitChan
|
||||
|
||||
if wshandleError(wsConn, err) {
|
||||
return
|
||||
}
|
||||
dt := time.Now().Add(time.Second)
|
||||
_ = wsConn.WriteControl(websocket.CloseMessage, nil, dt)
|
||||
}
|
||||
|
||||
func (b *BaseApi) ContainerWsSSH(c *gin.Context) {
|
||||
|
|
@ -133,9 +132,9 @@ func (b *BaseApi) ContainerWsSSH(c *gin.Context) {
|
|||
<-quitChan
|
||||
|
||||
global.LOG.Info("websocket finished")
|
||||
if wshandleError(wsConn, err) {
|
||||
return
|
||||
}
|
||||
dt := time.Now().Add(time.Second)
|
||||
_ = wsConn.WriteControl(websocket.CloseMessage, nil, dt)
|
||||
|
||||
}
|
||||
|
||||
func loadRedisInitCmd(c *gin.Context) (string, string, error) {
|
||||
|
|
|
|||
|
|
@ -100,4 +100,5 @@ func (lcmd *LocalCommand) Wait(quitChan chan bool) {
|
|||
global.LOG.Errorf("ssh session wait failed, err: %v", err)
|
||||
setQuit(quitChan)
|
||||
}
|
||||
setQuit(quitChan)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,9 @@ function onClose(isKeepShow: boolean = false) {
|
|||
term.value.dispose();
|
||||
} catch {}
|
||||
}
|
||||
terminalElement.value.innerHTML = '';
|
||||
if (terminalElement.value) {
|
||||
terminalElement.value.innerHTML = '';
|
||||
}
|
||||
}
|
||||
|
||||
// terminal 相关代码 start
|
||||
|
|
@ -202,10 +204,10 @@ const errorRealTerminal = (ex: any) => {
|
|||
|
||||
const closeRealTerminal = (ev: CloseEvent) => {
|
||||
if (heartbeatTimer.value) {
|
||||
clearInterval(heartbeatTimer.value);
|
||||
clearInterval(Number(heartbeatTimer.value));
|
||||
}
|
||||
term.value.write('The connection has been disconnected.');
|
||||
term.value.write(ev.reason);
|
||||
term.value?.write('The connection has been disconnected.');
|
||||
term.value?.write(ev.reason);
|
||||
};
|
||||
|
||||
const isWsOpen = () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue