提交 f74e71f9 作者: Jeromy

fix ugly error message when killing commands

上级 6036b043
...@@ -496,22 +496,24 @@ func (i *cmdInvocation) setupInterruptHandler() { ...@@ -496,22 +496,24 @@ func (i *cmdInvocation) setupInterruptHandler() {
case <-ctx.InitDone: case <-ctx.InitDone:
} }
switch count {
case 0:
fmt.Println(shutdownMessage)
if ctx.Online {
go func() {
// TODO cancel the command context instead // TODO cancel the command context instead
n, err := ctx.GetNode() n, err := ctx.GetNode()
if err != nil { if err != nil {
log.Error(err) log.Error(err)
fmt.Println(shutdownMessage) fmt.Println(shutdownMessage)
os.Exit(-1) os.Exit(-1)
} }
switch count {
case 0:
fmt.Println(shutdownMessage)
go func() {
n.Close() n.Close()
log.Info("Gracefully shut down.") 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 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论