func (r *EtcdMigrateServer) Stop() error {
	if r.cmd == nil {
		return fmt.Errorf("cannot stop EtcdMigrateServer that has not been started")
	}
	err := r.cmd.Process.Signal(os.Interrupt)
	if err != nil {
		return fmt.Errorf("error sending SIGINT to etcd for graceful shutdown: %v", err)
	}
	gracefulWait := time.Minute * 2
	stopped := make(chan bool)
	timedout := make(chan bool)
	go func() {
		time.Sleep(gracefulWait)
		timedout <- true
	}()
	go func() {
		select {
		case <-stopped:
			return
		case <-timedout:
			klog.Infof("etcd server has not terminated gracefully after %s, killing it.", gracefulWait)
			r.cmd.Process.Kill()
			return
		}
	}()
	err = r.cmd.Wait()
	stopped <- true
	if exiterr, ok := err.(*exec.ExitError); ok {
		klog.Infof("etcd server stopped (signal: %s)", exiterr.Error())
		// stopped
	} else if err != nil {
		return fmt.Errorf("error waiting for etcd to stop: %v", err)
	}
	klog.Infof("Stopped etcd server %s", r.cfg.name)
	return nil
}
// Stop terminates the etcd server process. If the etcd server process has not been started
// or is not still running, this returns an error.
Stop terminates the etcd server process. If the etcd server process has not been started
or is not still running, this returns an error.
// Stop terminates the etcd server process . If the etcd server process has not been started // or is not still running this returns an error .
func (r *EtcdMigrateServer) Stop() error {
	if r.cmd == nil {
		return fmt.Errorf("cannot stop EtcdMigrateServer that has not been started")
	}
	err := r.cmd.Process.Signal(os.Interrupt)
	if err != nil {
		return fmt.Errorf("error sending SIGINT to etcd for graceful shutdown: %v", err)
	}
	gracefulWait := time.Minute * 2
	stopped := make(chan bool)
	timedout := make(chan bool)
	go func() {
		time.Sleep(gracefulWait)
		timedout <- true
	}()
	go func() {
		select {
		case <-stopped:
			return
		case <-timedout:
			klog.Infof("etcd server has not terminated gracefully after %s, killing it.", gracefulWait)
			r.cmd.Process.Kill()
			return
		}
	}()
	err = r.cmd.Wait()
	stopped <- true
	if exiterr, ok := err.(*exec.ExitError); ok {
		klog.Infof("etcd server stopped (signal: %s)", exiterr.Error())
	} else if err != nil {
		return fmt.Errorf("error waiting for etcd to stop: %v", err)
	}
	klog.Infof("Stopped etcd server %s", r.cfg.name)
	return nil
}
func ( r * EtcdMigrateServer ) Stop ( ) error { if r . cmd == nil { return fmt . Errorf ( " " ) } err := r . cmd . Process . Signal ( os . Interrupt ) if err != nil { return fmt . Errorf ( " " , err ) } gracefulWait := time . Minute * 2 stopped := make ( chan bool ) timedout := make ( chan bool ) go func ( ) { time . Sleep ( gracefulWait ) timedout <- true } ( ) go func ( ) { select { case <- stopped : return case <- timedout : klog . Infof ( " " , gracefulWait ) r . cmd . Process . Kill ( ) return } } ( ) err = r . cmd . Wait ( ) stopped <- true if exiterr , ok := err . ( * exec . ExitError ) ; ok { klog . Infof ( " " , exiterr . Error ( ) ) } else if err != nil { return fmt . Errorf ( " " , err ) } klog . Infof ( " " , r . cfg . name ) return nil }
Stop terminates the etcd server process.
Stop terminates the etcd server process .
// stopped