Documentation
¶
Overview ¶
Package exec runs child processes and streams their output line-by-line.
Built for `codag onboard`, where bulk log fetches (e.g. `vercel logs --since=7d`) can spit out hundreds of thousands of lines. The MCP-side `codag wrap` and MCP tools use the same streaming path so log commands do not have to finish before codag starts bounding their output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Streamed ¶
type Streamed struct {
Lines <-chan string
// contains filtered or unexported fields
}
Stream spawns `cmd args...` and returns a channel of non-empty trimmed stdout+stderr lines. The channel closes when the child exits, the context is cancelled, or maxLines lines have been emitted (whichever comes first). Calling Wait() blocks until the child exits and returns the child's exit error.
On context cancel or maxLines reached, the child is killed via the context. Always drain the channel — leaking a reader leaks a goroutine.
func Stream ¶
Stream starts the child and begins emitting lines on the returned channel. maxLines = 0 means unlimited.
func StreamStdout ¶
StreamStdout is like Stream, but stderr is captured only for Wait() errors. Use this for provider CLIs where stderr is command diagnostics, not log data.