diff --git a/src/signal_posix.go b/src/signal.go similarity index 54% rename from src/signal_posix.go rename to src/signal.go index b38531a..8962536 100644 --- a/src/signal_posix.go +++ b/src/signal.go @@ -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) } diff --git a/src/signal_other.go b/src/signal_other.go deleted file mode 100644 index ac617f4..0000000 --- a/src/signal_other.go +++ /dev/null @@ -1,13 +0,0 @@ -//go:build !unix - -package git_pages - -func OnReload(handler func()) { - // not implemented -} - -func WaitForInterrupt() { - for { - // Ctrl+C not supported - } -}