fix: 合并终端返回数据的代码

This commit is contained in:
Wankko Ree
2023-04-07 17:37:14 +08:00
committed by zhengkunwang223
parent 57a6417812
commit db64cf02bd
+4 -13
View File
@@ -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