mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
* signaler: improve cross-platform signal compatibility - Add runtime-based platform detection for signal handling - Include os.Kill only on Windows (cannot be caught/ignored on Unix) - Refactor signal initialization into separate getPlatformSignals function * signaler: add dependency injection and improve docs - Introduce SignalNotifier interface for testability - Add osSignalNotifier implementation and factory function - Enhance package and function documentation - Maintain backward compatibility with existing API * [signaler] simplify shutdown handling; drop SIGABRT/os.Kill * skip signaler tests on windows * support signaler interrupt tests and improve signal handling tests * removing getPlatformSignal function * remove signaler readme * Signaler: Return a channel from WaitForInterrupt * Signaler: fix comment Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com> * Signaler: require NoError to NoErrorf Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com> --------- Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com>
16 lines
355 B
Go
16 lines
355 B
Go
// Package signaler provides cross-platform signal handling for graceful application shutdown
|
|
package signaler
|
|
|
|
import (
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
)
|
|
|
|
// WaitForInterrupt returns a channel to receive termination signals
|
|
func WaitForInterrupt() chan os.Signal {
|
|
c := make(chan os.Signal, 1)
|
|
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
|
return c
|
|
}
|