controller: add more informative server exit messages

When exiting, we should ideally always print a message, and give details
as to exactly what error we received.

Signed-off-by: Justin Chadwell <me@jedevc.com>
pull/1620/head
Justin Chadwell 2 years ago
parent 56b9e785e5
commit 1b91bc2e02

@ -151,18 +151,21 @@ func serveCmd(dockerCli command.Cli) *cobra.Command {
errCh <- errors.Wrapf(err, "error on serving via socket %q", addr)
}
}()
var s os.Signal
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, os.Interrupt)
select {
case s = <-sigCh:
logrus.Debugf("got signal %v", s)
case err := <-errCh:
logrus.Errorf("got error %s, exiting", err)
return err
case s = <-sigCh:
logrus.Infof("got signal %s, exiting", s)
return nil
case <-doneCh:
logrus.Infof("rpc server done, exiting")
return nil
}
return nil
},
}

Loading…
Cancel
Save