···11+// See https://pkg.go.dev/os/signal#hdr-Windows for a description of what this module
22+// will do on Windows (tl;dr nothing calls the reload handler, the interrupt handler works
33+// more or less how you'd expect).
44+55+package git_pages
66+77+import (
88+ "os"
99+ "os/signal"
1010+ "syscall"
1111+)
1212+1313+func OnReload(handler func()) {
1414+ sighup := make(chan os.Signal, 1)
1515+ signal.Notify(sighup, syscall.SIGHUP)
1616+ go func() {
1717+ for {
1818+ <-sighup
1919+ handler()
2020+ }
2121+ }()
2222+}
2323+2424+func WaitForInterrupt() {
2525+ sigint := make(chan os.Signal, 1)
2626+ signal.Notify(sigint, syscall.SIGINT, syscall.SIGTERM)
2727+ <-sigint
2828+ signal.Stop(sigint)
2929+}
-13
src/signal_other.go
···11-//go:build !unix
22-33-package git_pages
44-55-func OnReload(handler func()) {
66- // not implemented
77-}
88-99-func WaitForInterrupt() {
1010- for {
1111- // Ctrl+C not supported
1212- }
1313-}