mirror of
https://github.com/containers/podman.git
synced 2025-10-18 03:33:32 +08:00
pkg/signal: rework CatchAll() behavior
Instead of catching all signals and then ignoring them inside the loop again just don't register them in Notify() to begin with. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -46,11 +46,14 @@ func ParseSignalNameOrNumber(rawSignal string) (syscall.Signal, error) {
|
||||
return -1, fmt.Errorf("invalid signal: %s", basename)
|
||||
}
|
||||
|
||||
// CatchAll catches all signals and relays them to the specified channel.
|
||||
// CatchAll catches all signals (except the ones that make no sense to handle/forward,
|
||||
// see isSignalIgnoredBySigProxy()) and relays them to the specified channel.
|
||||
func CatchAll(sigc chan os.Signal) {
|
||||
handledSigs := make([]os.Signal, 0, len(SignalMap))
|
||||
for _, s := range SignalMap {
|
||||
handledSigs = append(handledSigs, s)
|
||||
if !isSignalIgnoredBySigProxy(s) {
|
||||
handledSigs = append(handledSigs, s)
|
||||
}
|
||||
}
|
||||
signal.Notify(sigc, handledSigs...)
|
||||
}
|
||||
|
Reference in New Issue
Block a user