Skip to content

Commit

Permalink
fix: modify command output result
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeEirc committed Aug 2, 2024
1 parent 6151e51 commit cd4f610
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkg/proxy/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"context"
"encoding/json"
"fmt"
"strings"
"sync/atomic"
"time"
"unicode/utf8"
Expand Down Expand Up @@ -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]
}

Expand Down

0 comments on commit cd4f610

Please sign in to comment.