elvish/pkg/eval/transcripts_unix_test.go
2024-01-30 20:21:39 +00:00

22 lines
366 B
Go

//go:build unix
package eval_test
import (
"os"
"testing"
"time"
"golang.org/x/sys/unix"
"src.elv.sh/pkg/eval"
"src.elv.sh/pkg/testutil"
)
func injectTimeAfterWithSIGINTOrSkip(t *testing.T) {
testutil.Set(t, eval.TimeAfter,
func(_ *eval.Frame, d time.Duration) <-chan time.Time {
go unix.Kill(os.Getpid(), unix.SIGINT)
return time.After(d)
})
}