diff --git a/etcdmain/etcd.go b/etcdmain/etcd.go index 236755eaf784..01acac3a1eb2 100644 --- a/etcdmain/etcd.go +++ b/etcdmain/etcd.go @@ -189,7 +189,11 @@ func startEtcd(cfg *embed.Config) (<-chan struct{}, <-chan error, error) { return nil, nil, err } osutil.RegisterInterruptHandler(e.Server.Stop) - <-e.Server.ReadyNotify() // wait for e.Server to join the cluster + select { + case <-e.Server.ReadyNotify(): // wait for e.Server to join the cluster + case <-e.Server.StopNotify(): // publish aborted from 'ErrStopped' + e.Server.HardStop() + } return e.Server.StopNotify(), e.Err(), nil }