Commit f74e71f9 authored by Jeromy's avatar Jeromy

fix ugly error message when killing commands

parent 6036b043
...@@ -496,22 +496,24 @@ func (i *cmdInvocation) setupInterruptHandler() { ...@@ -496,22 +496,24 @@ func (i *cmdInvocation) setupInterruptHandler() {
case <-ctx.InitDone: case <-ctx.InitDone:
} }
// TODO cancel the command context instead
n, err := ctx.GetNode()
if err != nil {
log.Error(err)
fmt.Println(shutdownMessage)
os.Exit(-1)
}
switch count { switch count {
case 0: case 0:
fmt.Println(shutdownMessage) fmt.Println(shutdownMessage)
go func() { if ctx.Online {
n.Close() go func() {
log.Info("Gracefully shut down.") // TODO cancel the command context instead
}() n, err := ctx.GetNode()
if err != nil {
log.Error(err)
fmt.Println(shutdownMessage)
os.Exit(-1)
}
n.Close()
log.Info("Gracefully shut down.")
}()
} else {
os.Exit(0)
}
default: default:
fmt.Println("Received another interrupt before graceful shutdown, terminating...") fmt.Println("Received another interrupt before graceful shutdown, terminating...")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment