@cryptotaxi247 / kubo / commits / 01db359c0

Kill the daemon during its startup

Konstantin Koroviev committed Mar 12, 2015 at 12:05 UTC 01db359c0f960a2cf10662ecb65e67c908a22ec4
1 file changed +8 -3
cmd/ipfs/main.go
+8 -3
@@ -481,15 +481,20 @@ func (i *cmdInvocation) setupInterruptHandler() {
481 sig := allInterruptSignals()
482
483 go func() {
484 - // wait till the context is ready to be closed
485 - <-ctx.InitDone
486 -
484 // first time, try to shut down.
485
486 // loop because we may be
487 for count := 0; ; count++ {
488 <-sig
489
490 + // if we're still initializing, cannot use `ctx.GetNode()`
491 + select {
492 + default: // initialization not done
493 + fmt.Println("Received interrupt signal, shutting down...")
494 + os.Exit(-1)
495 + case <-ctx.InitDone:
496 + }
497 +
498 // TODO cancel the command context instead
499
500 n, err := ctx.GetNode()