diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-02-20 20:33:34 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-02-21 21:23:10 +0800 |
commit | 01507d9b9d872aa6dfaf3ad704b8c2b65e378a41 (patch) | |
tree | 65867213d25c4703addfff98471c134462e2f20b /cmd/utils | |
parent | 5603715c06998ff9ed30eb134c4398ad1439ef48 (diff) | |
download | go-tangerine-01507d9b9d872aa6dfaf3ad704b8c2b65e378a41.tar.gz go-tangerine-01507d9b9d872aa6dfaf3ad704b8c2b65e378a41.tar.zst go-tangerine-01507d9b9d872aa6dfaf3ad704b8c2b65e378a41.zip |
cmd, console: support all termination signals
Diffstat (limited to 'cmd/utils')
-rw-r--r-- | cmd/utils/cmd.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 53cdf7861..186d18d8f 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -25,6 +25,7 @@ import ( "os/signal" "runtime" "strings" + "syscall" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" @@ -64,7 +65,7 @@ func StartNode(stack *node.Node) { } go func() { sigc := make(chan os.Signal, 1) - signal.Notify(sigc, os.Interrupt) + signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM) defer signal.Stop(sigc) <-sigc log.Info("Got interrupt, shutting down...") @@ -85,7 +86,7 @@ func ImportChain(chain *core.BlockChain, fn string) error { // If a signal is received, the import will stop at the next batch. interrupt := make(chan os.Signal, 1) stop := make(chan struct{}) - signal.Notify(interrupt, os.Interrupt) + signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM) defer signal.Stop(interrupt) defer close(interrupt) go func() { |