Intermediate... working on debora

This commit is contained in:
Jae Kwon
2015-04-08 11:35:17 -07:00
parent cc18136af8
commit a09051438c
7 changed files with 68 additions and 26 deletions

View File

@ -2,7 +2,6 @@ package node
import (
"os"
"os/signal"
bc "github.com/tendermint/tendermint/blockchain"
. "github.com/tendermint/tendermint/common"
@ -166,20 +165,7 @@ func RunNode() {
}
// Sleep forever and then...
trapSignal(func() {
TrapSignal(func() {
n.Stop()
})
}
func trapSignal(cb func()) {
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
go func() {
for sig := range c {
log.Info(Fmt("captured %v, exiting..", sig))
cb()
os.Exit(1)
}
}()
select {}
}