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.
| 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) |
nothing calls this directly
no outgoing calls
no test coverage detected