mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +00:00
* linter: Enable gofumpt and run against codebase * Address shazbert's nits * gofumpt: Fix issues after rebase
26 lines
359 B
Go
26 lines
359 B
Go
package signaler
|
|
|
|
import (
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
)
|
|
|
|
var s = make(chan os.Signal, 1)
|
|
|
|
func init() {
|
|
sigs := []os.Signal{
|
|
os.Interrupt,
|
|
os.Kill,
|
|
syscall.SIGTERM,
|
|
syscall.SIGABRT,
|
|
}
|
|
signal.Notify(s, sigs...)
|
|
}
|
|
|
|
// WaitForInterrupt waits until a os.Signal is
|
|
// received and returns the result
|
|
func WaitForInterrupt() os.Signal {
|
|
return <-s
|
|
}
|