1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 19:32:24 +08:00

Unify shutdown message format string

This commit is contained in:
Tor Arne Vestbø
2015-04-07 14:12:22 +02:00
parent 0bb4df9d3b
commit 675e2c7f85

View File

@ -40,6 +40,7 @@ const (
cpuProfile = "ipfs.cpuprof"
heapProfile = "ipfs.memprof"
errorFormat = "ERROR: %v\n\n"
shutdownMessage = "Received interrupt signal, shutting down..."
)
type cmdInvocation struct {
@ -490,7 +491,7 @@ func (i *cmdInvocation) setupInterruptHandler() {
// if we're still initializing, cannot use `ctx.GetNode()`
select {
default: // initialization not done
fmt.Println("Received interrupt signal, shutting down...")
fmt.Println(shutdownMessage)
os.Exit(-1)
case <-ctx.InitDone:
}
@ -500,13 +501,13 @@ func (i *cmdInvocation) setupInterruptHandler() {
n, err := ctx.GetNode()
if err != nil {
log.Error(err)
fmt.Println("Received interrupt signal, terminating...")
fmt.Println(shutdownMessage)
os.Exit(-1)
}
switch count {
case 0:
fmt.Println("Received interrupt signal, shutting down...")
fmt.Println(shutdownMessage)
go func() {
n.Close()
log.Info("Gracefully shut down.")