Only print final collection when runing --test (#4991)

This commit is contained in:
Greg
2018-11-15 16:44:36 -07:00
committed by Daniel Nelson
parent 274af39a5e
commit 91ecec71ea
2 changed files with 45 additions and 23 deletions

View File

@@ -83,7 +83,8 @@ func reloadLoop(
ctx, cancel := context.WithCancel(context.Background())
signals := make(chan os.Signal)
signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGTERM)
signal.Notify(signals, os.Interrupt, syscall.SIGHUP,
syscall.SIGTERM, syscall.SIGINT)
go func() {
select {
case sig := <-signals:
@@ -154,7 +155,7 @@ func runAgent(ctx context.Context,
)
if *fTest {
return ag.Test()
return ag.Test(ctx)
}
log.Printf("I! Starting Telegraf %s\n", version)