still working

This commit is contained in:
Dev
2025-12-13 15:31:52 +00:00
parent dda7abedb7
commit d69e01bbaf
18 changed files with 795 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
package osexec
import (
"context"
"time"
)
// FakeRunner is a test-friendly Runner that returns pre-determined values, supports delays, and can simulate timeouts.
type FakeRunner struct {
Stdout string
Stderr string
ExitCode int
Delay time.Duration
Err error
}
func (f *FakeRunner) Run(ctx context.Context, name string, args ...string) (string, string, int, error) {
if f.Delay > 0 {
select {
case <-time.After(f.Delay):
case <-ctx.Done():
// Pass through context error
return "", "", -1, ctx.Err()
}
}
return f.Stdout, f.Stderr, f.ExitCode, f.Err
}