fork of whitequark.org/git-pages with mods for tangled
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Exit gracefully (run deferred statements in main()) on SIGINT.

miyuko b01e67f9 b5a1626a

+20 -1
+6 -1
src/main.go
··· 384 384 } else { 385 385 log.Println("serve: ready") 386 386 } 387 - select {} 387 + 388 + interrupt := make(chan struct{}) 389 + OnInterrupt(func() { interrupt <- struct{}{} }) 390 + <-interrupt 391 + 392 + log.Println("exiting gracefully") 388 393 } 389 394 }
+4
src/signal_other.go
··· 5 5 func OnReload(handler func()) { 6 6 // not implemented 7 7 } 8 + 9 + func OnInterrupt(handler func()) { 10 + // not implemented 11 + }
+10
src/signal_posix.go
··· 18 18 } 19 19 }() 20 20 } 21 + 22 + func OnInterrupt(handler func()) { 23 + sigint := make(chan os.Signal, 1) 24 + signal.Notify(sigint, syscall.SIGINT) 25 + go func() { 26 + <-sigint 27 + signal.Stop(sigint) 28 + handler() 29 + }() 30 + }