// Restart kills the process, removes the old binary and
// restarts the new process
771784
func (r *Runner) restart(fileName string) {
	r.kill(r.cmd)

	r.start <- fileName
}
374238
func (p *Process) Stop() error {
	p.mtx.Lock()
	defer p.mtx.Unlock()

	if !p.running {
		return ErrStopped
	}
	return p.stop()
}
151571
func Restart(label string, wait time.Duration, log Log) error {
	service := NewService(label)
	service.SetLogger(log)
	if _, err := service.Stop(wait); err != nil {
		return err
	}
	return service.Start(wait)
}
526690
func (s *State232) Reset() {
	s.seed = 0
	s.clen = 0
	s.tail = nil
}
1336312
func (b *BitWriter) Reset(w io.Writer) {
	b.w = w
	b.b[0] = 0x00
	b.count = 8
}
1132220
func (actor Actor) RestartApplication(appGUID string) (Warnings, error) {
	var allWarnings Warnings
	_, warnings, err := actor.CloudControllerClient.UpdateApplicationRestart(appGUID)
	allWarnings = append(allWarnings, warnings...)
	if err != nil {
		return allWarnings, err
	}

	pollingWarnings, err := actor.PollStart(appGUID)
	allWarnings = append(allWarnings, pollingWarnings...)
	return allWarnings, err
}
242450
func (e *Empire) Restart(ctx context.Context, opts RestartOpts) error {
	if err := opts.Validate(e); err != nil {
		return err
	}

	if err := e.apps.Restart(ctx, e.db, opts); err != nil {
		return err
	}

	return e.PublishEvent(opts.Event())

}
870368
func Kill() {
	procsLock.Lock()
	defer procsLock.Unlock()
	for _, proc := range procs {
		proc.Process.Kill()
	}
	procs = nil
}
1146552
func (launcher *Launcher) Restart(args []string) {
	launcher.Mutex.Lock()
	defer launcher.Mutex.Unlock()
	launcher.args = args

	if launcher.process == nil {
		return
	}
	if err := launcher.process.Kill(); err != nil {
		log.WithError(err).WithField("pid", launcher.process.Pid).Error("process.Kill()")
	}
	launcher.process = nil
}
411056
func RestartCommand(factory app.ProjectFactory) cli.Command {
	return cli.Command{
		Name:   "restart",
		Usage:  "Restart services",
		Action: app.WithProject(factory, app.ProjectRestart),
		Flags: []cli.Flag{
			cli.IntFlag{
				Name:  "timeout,t",
				Usage: "Specify a shutdown timeout in seconds.",
			},
		},
	}
}
713594
func (s *Source) Reset() {
	if pdebug.Enabled {
		g := pdebug.Marker("Source.Reset")
		defer g.End()
	}
	s.ChanOutput = pipeline.ChanOutput(make(chan interface{}))
}
337625
func (l *loop) Restart() error {
	l.mux.Lock()
	defer l.mux.Unlock()
	if l.status != Stopped {
		return errors.New(ErrRestartNonStopped, errorMessages, l)
	}
	l.err = nil
	l.recoverings = nil
	l.status = Running
	l.stopC = make(chan struct{})
	l.doneC = make(chan struct{})
	// Restart the goroutine.
	l.logf(false, "loop %q restarts", l)
	go l.run()
	<-l.startedC
	return nil
}
2862
func (b *Buffer) Reset() {
	b.Line = b.Line[:0]
	b.Val = b.Val[:0]
}
373614
func (d *Buzhash64) Reset() {
	d.window = d.window[:0]
	d.oldest = 0
	d.sum = 0
}
819999
func (s *releasesService) Restart(ctx context.Context, db *gorm.DB, app *App) error {
	return s.Scheduler.Restart(ctx, app.ID, nil)
}
705077
func (i *Instance) Restart(newCaddyfile Input) (*Instance, error) {
	log.Println("[INFO] Reloading")

	i.wg.Add(1)
	defer i.wg.Done()

	var err error
	// if something went wrong on restart then run onRestartFailed callbacks
	defer func() {
		r := recover()
		if err != nil || r != nil {
			for _, fn := range i.OnRestartFailed {
				if err := fn(); err != nil {
					log.Printf("[ERROR] Restart failed callback returned error: %v", err)
				}
			}
			if err != nil {
				log.Printf("[ERROR] Restart failed: %v", err)
			}
			if r != nil {
				log.Printf("[PANIC] Restart: %v", r)
			}
		}
	}()

	// run restart callbacks
	for _, fn := range i.OnRestart {
		err = fn()
		if err != nil {
			return i, err
		}
	}

	if newCaddyfile == nil {
		newCaddyfile = i.caddyfileInput
	}

	// Add file descriptors of all the sockets that are capable of it
	restartFds := make(map[string]restartTriple)
	for _, s := range i.servers {
		gs, srvOk := s.server.(GracefulServer)
		ln, lnOk := s.listener.(Listener)
		pc, pcOk := s.packet.(PacketConn)
		if srvOk {
			if lnOk && pcOk {
				restartFds[gs.Address()] = restartTriple{server: gs, listener: ln, packet: pc}
				continue
			}
			if lnOk {
				restartFds[gs.Address()] = restartTriple{server: gs, listener: ln}
				continue
			}
			if pcOk {
				restartFds[gs.Address()] = restartTriple{server: gs, packet: pc}
				continue
			}
		}
	}

	// create new instance; if the restart fails, it is simply discarded
	newInst := &Instance{serverType: newCaddyfile.ServerType(), wg: i.wg, Storage: make(map[interface{}]interface{})}

	// attempt to start new instance
	err = startWithListenerFds(newCaddyfile, newInst, restartFds)
	if err != nil {
		return i, fmt.Errorf("starting with listener file descriptors: %v", err)
	}

	// success! stop the old instance
	err = i.Stop()
	if err != nil {
		return i, err
	}
	for _, shutdownFunc := range i.OnShutdown {
		err = shutdownFunc()
		if err != nil {
			return i, err
		}
	}

	// Execute instantiation events
	EmitEvent(InstanceStartupEvent, newInst)

	log.Println("[INFO] Reloading complete")

	return newInst, nil
}
643553
func (b *Binary) Init() error {
	b.cmd = exec.Command(b.binPath, b.args...)
	stdout, _ := b.cmd.StdoutPipe()
	stdOutScanner := bufio.NewScanner(stdout)
	stderr, _ := b.cmd.StderrPipe()
	stdErrScanner := bufio.NewScanner(stderr)
	go func() {
		for stdOutScanner.Scan() {
			logger.Log.Info(stdOutScanner.Text())
		}
	}()
	go func() {
		for stdErrScanner.Scan() {
			logger.Log.Error(stdErrScanner.Text())
		}
	}()
	err := b.cmd.Start()
	go func() {
		b.cmd.Wait()
		close(b.exitCh)
	}()
	return err
}