Documentation
¶
Overview ¶
Package proc bounds the lifetime of the external processes draft starts.
Killing a process on timeout is not enough to end a call. A provider CLI can leave a background process behind, and that process inherits the CLI's stdout and stderr: Wait then waits for output that never closes, and a three-second timeout was seen still blocked after three minutes. So a bounded command runs in its own process group, cancellation kills the whole group, and WaitDelay caps how long Wait lingers for output once the process is gone.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var WaitDelay = 5 * time.Second
WaitDelay is how long Wait waits for a process's output to close once the process has exited or its context is done. A variable so tests can shorten it.
Functions ¶
func Bound ¶
Bound sets cmd up so that neither the process nor anything it starts can hold a call open past its context. Call it before Start.
func Detach ¶ added in v0.0.48
Detach puts cmd in a process group of its own, where the platform has them, without bounding it. It is for a process meant to outlive draft: a terminal delivers Ctrl-C to the whole foreground process group, so a child left in draft's group is interrupted along with it. Call it before Start.
Types ¶
This section is empty.