mirror of
https://github.com/anchore/grype
synced 2024-11-14 16:27:15 +00:00
b1f3be4520
* split and upgrade config processing Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * upgrade UI organization Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * expose logger writter Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add (unused) signal handler Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add (unused) event loop abstraction Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update aux commands to use Cobra RunE over Run Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * upgrade root command to use new event loop and signal handler Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update CLI test to account for config representation Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update dependencies + fix linting Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * decompose application config parse func + add missing config struct tags Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * restore unparam lint exclusion for registry config Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
20 lines
344 B
Go
20 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
|
|
}
|