mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-02-24 14:54:43 +08:00
fix: 合并终端返回数据的代码
This commit is contained in:
parent
57a6417812
commit
db64cf02bd
1 changed files with 4 additions and 13 deletions
|
@ -164,19 +164,6 @@ func (sws *LogicSshWsSession) sendComboOutput(exitCh chan bool) {
|
|||
return
|
||||
}
|
||||
bs := sws.comboOutput.Bytes()
|
||||
if string(bs) == string([]byte{13, 10, 108, 111, 103, 111, 117, 116, 13, 10}) {
|
||||
err := wsConn.WriteMessage(websocket.TextMessage, bs)
|
||||
if err != nil {
|
||||
global.LOG.Errorf("ssh sending combo output to webSocket failed, err: %v", err)
|
||||
}
|
||||
_, err = sws.logBuff.Write(bs)
|
||||
if err != nil {
|
||||
global.LOG.Errorf("combo output to log buffer failed, err: %v", err)
|
||||
}
|
||||
sws.comboOutput.buffer.Reset()
|
||||
sws.Close()
|
||||
return
|
||||
}
|
||||
if len(bs) > 0 {
|
||||
err := wsConn.WriteMessage(websocket.TextMessage, bs)
|
||||
if err != nil {
|
||||
|
@ -188,6 +175,10 @@ func (sws *LogicSshWsSession) sendComboOutput(exitCh chan bool) {
|
|||
}
|
||||
sws.comboOutput.buffer.Reset()
|
||||
}
|
||||
if string(bs) == string([]byte{13, 10, 108, 111, 103, 111, 117, 116, 13, 10}) {
|
||||
sws.Close()
|
||||
return
|
||||
}
|
||||
|
||||
case <-exitCh:
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue