Some checks failed
Test and build / Build receiver (amd64, , linux) (push) Failing after 40s
Test and build / Build receiver (arm, 6, linux) (push) Failing after 41s
Test and build / Build receiver (arm, 7, linux) (push) Failing after 40s
Test and build / Build collector (push) Failing after 54s
Test and build / test (push) Successful in 59s
28 lines
543 B
Go
28 lines
543 B
Go
package cmd
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/urfave/cli/v3"
|
|
)
|
|
|
|
func AllFlags(configFile string) []cli.Flag {
|
|
return append(ConfigFlags(configFile), LoggerFlags()...)
|
|
}
|
|
|
|
func WaitForInterrupt(logger *logrus.Logger, what string) error {
|
|
sigs := make(chan os.Signal, 1)
|
|
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
|
|
|
logger.Infof("%s: running, interrupt with ^C", what)
|
|
for sig := range sigs {
|
|
return errors.New("terminating on signal " + sig.String())
|
|
}
|
|
|
|
return nil
|
|
}
|