MCPcopy Create free account
hub / github.com/codehamr/codehamr / headTailBuffer

Struct headTailBuffer

internal/tools/bash.go:231–236  ·  view source on GitHub ↗

headTailBuffer is an io.Writer keeping the first bashOutputHead and the last bashOutputTail bytes written, discarding the middle. The tail is a fixed ring so a firehose costs a bounded copy, never an allocation per write.

Source from the content-addressed store, hash-verified

229 // an npm install) run twice: once to hit the deadline, once with a
230 // bigger timeout. Clamp seconds BEFORE the Duration multiply: 1e18
231 // would overflow int64 into a negative duration, and 0.5 would truncate
232 // to 0 and cancel before the shell runs, so floor at 1.
233 timeout := 10 * time.Minute
234 if secs := intArg(call.Arguments, "timeout_seconds"); secs > 0 {
235 timeout = time.Duration(min(max(secs, 1), maxBashTimeoutSeconds)) * time.Second
236 }
237 return Bash(parent, cmd, timeout)
238 case WriteFileName:
239 path, _ := call.Arguments["path"].(string)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected