Unify shutdown message format string
Tor Arne Vestbø committed
Apr 7, 2015 at 14:12 UTC
675e2c7f85376cbfeebc6ca078ec1334b7fc545e
1 file changed
+4
-3
cmd/ipfs/main.go
+4
-3
@@ -40,6 +40,7 @@ const (
40
cpuProfile = "ipfs.cpuprof"
41
heapProfile = "ipfs.memprof"
42
errorFormat = "ERROR: %v\n\n"
43
+ shutdownMessage = "Received interrupt signal, shutting down..."
44
)
45
46
type cmdInvocation struct {
@@ -490,7 +491,7 @@ func (i *cmdInvocation) setupInterruptHandler() {
491
// if we're still initializing, cannot use `ctx.GetNode()`
492
select {
493
default: // initialization not done
493
- fmt.Println("Received interrupt signal, shutting down...")
494
+ fmt.Println(shutdownMessage)
495
os.Exit(-1)
496
case <-ctx.InitDone:
497
}
@@ -500,13 +501,13 @@ func (i *cmdInvocation) setupInterruptHandler() {
501
n, err := ctx.GetNode()
502
if err != nil {
503
log.Error(err)
503
- fmt.Println("Received interrupt signal, terminating...")
504
+ fmt.Println(shutdownMessage)
505
os.Exit(-1)
506
}
507
508
switch count {
509
case 0:
509
- fmt.Println("Received interrupt signal, shutting down...")
510
+ fmt.Println(shutdownMessage)
511
go func() {
512
n.Close()
513
log.Info("Gracefully shut down.")