mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
21 lines
344 B
Go
21 lines
344 B
Go
package cmd
|
|
|
|
import (
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
)
|
|
|
|
func setupSignals() <-chan os.Signal {
|
|
c := make(chan os.Signal, 1) // Note: A buffered channel is recommended for this; see https://golang.org/pkg/os/signal/#Notify
|
|
|
|
interruptions := []os.Signal{
|
|
syscall.SIGINT,
|
|
syscall.SIGTERM,
|
|
}
|
|
|
|
signal.Notify(c, interruptions...)
|
|
|
|
return c
|
|
}
|