Files
yay/main_test.go
github-actions[bot]andCopilot 7c18572d22 [repo-assist] fix: clean up ALPM lock on interrupt (#2962)
fix: clean up ALPM lock on interrupt

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-27 00:12:48 +02:00

27 lines
415 B
Go

package main
import (
"os"
"testing"
"time"
)
func TestInterruptCancelsContext(t *testing.T) {
ctx, stop := newSignalContext()
defer stop()
process, err := os.FindProcess(os.Getpid())
if err != nil {
t.Fatal(err)
}
if err := process.Signal(os.Interrupt); err != nil {
t.Fatal(err)
}
select {
case <-ctx.Done():
case <-time.After(time.Second):
t.Fatal("interrupt did not cancel context")
}
}