From 5de972ba418548f8d1f979fc1a7aa21f4e3d89a0 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 2 Aug 2024 18:45:33 +0800 Subject: [PATCH] fix: modify command output result --- pkg/proxy/switch.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/proxy/switch.go b/pkg/proxy/switch.go index 4622ce63..a16935ca 100644 --- a/pkg/proxy/switch.go +++ b/pkg/proxy/switch.go @@ -5,7 +5,6 @@ import ( "context" "encoding/json" "fmt" - "strings" "sync/atomic" "time" "unicode/utf8" @@ -114,12 +113,8 @@ func (s *SwitchSession) generateCommandResult(item *ExecutedCommand) *model.Comm } else { input = item.Command } - i := strings.LastIndexByte(item.Output, '\r') - if i <= 0 { - output = item.Output - } else if i > 0 && i < maxBufSize { - output = item.Output[:i] - } else { + output = item.Output + if len(output) > maxBufSize { output = item.Output[:maxBufSize] }