mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
18c7c67308
- pkg/useragent - pkg/units - pkg/ulimit - pkg/truncindex - pkg/timeoutconn - pkg/term - pkg/tarsum - pkg/tailfile - pkg/systemd - pkg/stringutils - pkg/stringid - pkg/streamformatter - pkg/sockets - pkg/signal - pkg/proxy - pkg/progressreader - pkg/pools - pkg/plugins - pkg/pidfile - pkg/parsers - pkg/parsers/filters - pkg/parsers/kernel - pkg/parsers/operatingsystem Signed-off-by: Vincent Demeester <vincent@sbr.pm>
23 lines
553 B
Go
23 lines
553 B
Go
// Package signal provides helper functions for dealing with signals across
|
|
// various operating systems.
|
|
package signal
|
|
|
|
import (
|
|
"os"
|
|
"os/signal"
|
|
)
|
|
|
|
// CatchAll catches all signals and relays them to the specified channel.
|
|
func CatchAll(sigc chan os.Signal) {
|
|
handledSigs := []os.Signal{}
|
|
for _, s := range SignalMap {
|
|
handledSigs = append(handledSigs, s)
|
|
}
|
|
signal.Notify(sigc, handledSigs...)
|
|
}
|
|
|
|
// StopCatch stops catching the signals and closes the specified channel.
|
|
func StopCatch(sigc chan os.Signal) {
|
|
signal.Stop(sigc)
|
|
close(sigc)
|
|
}
|