Standard library / os/signal
os/signal.Ignored()
Reports whether a signal is currently ignored. Example intended for Linux/AMD64 with Go 1.23.2 in a disposable working directory; other platforms may differ. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func Ignored(sig os.Signal) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| sig | os.Signal | Signal or list of signals, as indicated by the signature. |
Return Value
bool
Reports whether a signal is currently ignored.
Working Example
Example Snippetgo
package main
import ( "fmt" "os/signal" "syscall")
func must(e error) { if e != nil { panic(e) }}func main() { signal.Ignore(syscall.SIGUSR1) defer signal.Reset(syscall.SIGUSR1) fmt.Println(signal.Ignored(syscall.SIGUSR1))}