mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 00:47:48 +08:00
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>
This commit is contained in:
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…
x
Reference in New Issue
Block a user