From db64cf02bdd5ffb99b3d2a7121b1ca8592331c94 Mon Sep 17 00:00:00 2001 From: Wankko Ree Date: Thu, 6 Apr 2023 01:16:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=88=E5=B9=B6=E7=BB=88=E7=AB=AF?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=95=B0=E6=8D=AE=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/utils/terminal/ws_session.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/backend/utils/terminal/ws_session.go b/backend/utils/terminal/ws_session.go index dde12a5dd..2b432b8b5 100644 --- a/backend/utils/terminal/ws_session.go +++ b/backend/utils/terminal/ws_session.go @@ -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