mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-05-14 03:01:48 +00:00
Simplify signal handling code.
This does not require `//go:build`.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
//go:build !unix
|
||||
|
||||
package git_pages
|
||||
|
||||
func OnReload(handler func()) {
|
||||
// not implemented
|
||||
}
|
||||
|
||||
func WaitForInterrupt() {
|
||||
for {
|
||||
// Ctrl+C not supported
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user