Files
yatm/internal/preview/command.go
T
Samuel Cui 4fef653b71 Prepare YATM v1.0.0-alpha.2
Unify file queries and Scan execution, retain indexed Identical results,
improve Job and Preview workflows, and verify release packaging.
2026-10-05 19:08:49 +08:00

22 lines
364 B
Go

package preview
import "bytes"
const commandOutputLimit = 64 << 10
type limitedBuffer struct {
bytes.Buffer
limit int
}
func (b *limitedBuffer) Write(data []byte) (int, error) {
remaining := b.limit - b.Len()
if remaining > 0 {
if remaining > len(data) {
remaining = len(data)
}
_, _ = b.Buffer.Write(data[:remaining])
}
return len(data), nil
}