diff --git a/tools/tm-bench/main.go b/tools/tm-bench/main.go index a418e0363..a7c427c03 100644 --- a/tools/tm-bench/main.go +++ b/tools/tm-bench/main.go @@ -12,6 +12,8 @@ import ( "github.com/tendermint/tendermint/libs/log" tmrpc "github.com/tendermint/tendermint/rpc/client" + "os/signal" + "syscall" ) var logger = log.NewNopLogger() @@ -101,6 +103,19 @@ Examples: "broadcast_tx_"+broadcastTxMethod, ) + //catch Interrupt and quit tm-bench + go func() { + c := make(chan os.Signal, 1) + signal.Notify(c, os.Interrupt, syscall.SIGTERM) + for sig := range c { + fmt.Printf("captured %v, exiting...\n", sig) + for _, t := range transacters { + t.Stop() + } + os.Exit(1) + } + }() + // Wait until transacters have begun until we get the start time timeStart := time.Now() logger.Info("Time last transacter started", "t", timeStart)