package signal
import "github.com/moby/sys/signal"
Package signal provides helper functions for dealing with signals across various operating systems.
Index ¶
- Constants
- Variables
- func CatchAll(sigc chan os.Signal)
- func ParseSignal(rawSignal string) (syscall.Signal, error)
- func StopCatch(sigc chan os.Signal)
- func ValidSignalForPlatform(sig syscall.Signal) bool
Constants ¶
const ( SIGCHLD = syscall.Signal(0xff) SIGWINCH = syscall.Signal(0xff) SIGPIPE = syscall.Signal(0xff) )
Signals used in cli/command (no windows equivalent, use invalid signals so they don't get handled)
Variables ¶
var SignalMap = map[string]syscall.Signal{ "ABRT": syscall.Signal(windows.SIGABRT), "ALRM": syscall.Signal(windows.SIGALRM), "BUS": syscall.Signal(windows.SIGBUS), "FPE": syscall.Signal(windows.SIGFPE), "HUP": syscall.Signal(windows.SIGHUP), "ILL": syscall.Signal(windows.SIGILL), "INT": syscall.Signal(windows.SIGINT), "KILL": syscall.Signal(windows.SIGKILL), "PIPE": syscall.Signal(windows.SIGPIPE), "QUIT": syscall.Signal(windows.SIGQUIT), "SEGV": syscall.Signal(windows.SIGSEGV), "TERM": syscall.Signal(windows.SIGTERM), "TRAP": syscall.Signal(windows.SIGTRAP), }
SignalMap is a map of "supported" signals. As per the comment in GOLang's ztypes_windows.go: "More invented values for signals". Windows doesn't really support signals in any way, shape or form that Unix does.
Functions ¶
func CatchAll ¶
CatchAll catches all signals and relays them to the specified channel. SIGURG is not handled, as it's used by the Go runtime to support preemptable system calls.
func ParseSignal ¶
ParseSignal translates a string to a valid syscall signal. It returns an error if the signal map doesn't include the given signal.
func StopCatch ¶
StopCatch stops catching the signals and closes the specified channel.
func ValidSignalForPlatform ¶
ValidSignalForPlatform returns true if a signal is valid on the platform
Source Files ¶
- Version
- v0.6.0
- Published
- Nov 5, 2021
- Platform
- windows/amd64
- Imports
- 7 packages
- Last checked
- 1 week ago –
Tools for package owners.