Simplify signal handling code.

This does not require `//go:build`.
This commit is contained in:
Catherine
2025-12-11 10:09:29 +00:00
parent a9cf69c04a
commit 7f112a761c
2 changed files with 4 additions and 15 deletions

View File

@@ -1,4 +1,6 @@
//go:build unix
// See https://pkg.go.dev/os/signal#hdr-Windows for a description of what this module
// will do on Windows (tl;dr nothing calls the reload handler, the interrupt handler works
// more or less how you'd expect).
package git_pages
@@ -21,7 +23,7 @@ func OnReload(handler func()) {
func WaitForInterrupt() {
sigint := make(chan os.Signal, 1)
signal.Notify(sigint, syscall.SIGINT)
signal.Notify(sigint, syscall.SIGINT, syscall.SIGTERM)
<-sigint
signal.Stop(sigint)
}

View File

@@ -1,13 +0,0 @@
//go:build !unix
package git_pages
func OnReload(handler func()) {
// not implemented
}
func WaitForInterrupt() {
for {
// Ctrl+C not supported
}
}