05ae530442
Install current verified harness releases inside Docker, preserve persistent accounts and settings, and provide separate interactive and pipeline model defaults with terminal onboarding and fuzzy pickers. Add Docker-aware authoring transport, Pi stage execution, bounded workflow controls, reliable final-result readback and usage settlement, and finite short-lived CLI pipe draining. Keep dated installation evidence and packaged authoring guidance consistent. Verified with a real Docker installation, both harness stages and interactive authors, the built-in plan/implement/review starter, independent host race/vet checks, installer tests, and packaged skill tests. Generated release receipts stay ignored in clean checkouts.
26 lines
1.0 KiB
Go
26 lines
1.0 KiB
Go
package opencode
|
|
|
|
import (
|
|
"context"
|
|
"os/exec"
|
|
"time"
|
|
)
|
|
|
|
// ShortLivedWaitDelay is the single finite grace for draining inherited output
|
|
// pipes of short-lived, context-controlled CLI calls (API calls, `--help`
|
|
// detection and the native export fallback). After the child exits os/exec waits
|
|
// at most this long for descendants that still hold the inherited stdout/stderr
|
|
// pipes, then closes the pipes and reports exec.ErrWaitDelay. It bounds pipe
|
|
// draining only: it does not terminate, signal or confirm cleanup of descendants.
|
|
const ShortLivedWaitDelay = 250 * time.Millisecond
|
|
|
|
// CommandContext builds a short-lived CLI command with a finite WaitDelay so a
|
|
// context cancellation or a descendant-held output pipe cannot block the caller
|
|
// for the child's natural lifetime. Callers still set Dir, Stdout and Stderr.
|
|
// It has no dependencies and no side effects.
|
|
func CommandContext(ctx context.Context, executable string, args ...string) *exec.Cmd {
|
|
cmd := exec.CommandContext(ctx, executable, args...)
|
|
cmd.WaitDelay = ShortLivedWaitDelay
|
|
return cmd
|
|
}
|