mirror of
https://github.com/anchore/syft
synced 2024-11-10 14:24:12 +00:00
962e82297c
* split UI from event handling Signed-off-by: Alex Goodman <wagoodman@gmail.com> * add event loop tests Signed-off-by: Alex Goodman <wagoodman@gmail.com> * use stereoscope cleanup function during signal handling Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * correct error wrapping in packages cmd Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * migrate ui event handlers to ui package Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * clarify command worker input var + remove dead comments 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
|
|
}
|