mirror of
https://github.com/samuelncui/yatm.git
synced 2026-11-08 04:18:03 +00:00
Unify file queries and Scan execution, retain indexed Identical results, improve Job and Preview workflows, and verify release packaging.
22 lines
364 B
Go
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
|
|
}
|