// Run starts the engine.
557758
func (e *LoginWithPaperKey) Run(m libkb.MetaContext) error {
	me, err := libkb.LoadMe(libkb.NewLoadUserArgWithMetaContext(m).WithForceReload())
	if err != nil {
		return err
	}

	if loggedIn, _ := isLoggedIn(m); loggedIn {
		m.Debug("Already logged in with unlocked device keys")
		return nil
	}

	// Prompts for a paper key.
	m.Debug("No device keys available; getting paper key")
	kp, err := findPaperKeys(m, me)
	if err != nil {
		return err
	}

	// Switch config file to our new user, and zero out the current active device.
	if err = m.SwitchUser(me.GetNormalizedName()); err != nil {
		return err
	}

	// Convert our paper keys into a provisional active device, to use for
	// API session authentication. BAM! We're "logged in".
	m = m.WithProvisioningKeyActiveDevice(kp, me.ToUserVersion())

	// Get the LKS client half.
	gen, clientLKS, err := fetchLKS(m, kp.EncryptionKey())
	if err != nil {
		return err
	}
	lks := libkb.NewLKSecWithClientHalf(clientLKS, gen, me.GetUID())
	m.Debug("Got LKS client half")

	// Get the LKS server half.
	err = lks.Load(m)
	if err != nil {
		return err
	}
	m.Debug("Got LKS full")

	secretStore := libkb.NewSecretStore(m.G(), me.GetNormalizedName())
	m.Debug("Got secret store")

	// Extract the LKS secret
	secret, err := lks.GetSecret(m)
	if err != nil {
		return err
	}
	m.Debug("Got LKS secret")

	err = secretStore.StoreSecret(m, secret)
	if err != nil {
		return err
	}
	m.Debug("Stored secret with LKS from paperkey")

	// Remove our provisional active device, and fall back to global device
	m = m.WithGlobalActiveDevice()

	// This could prompt but shouldn't because of the secret store.
	if _, err = libkb.BootstrapActiveDeviceFromConfig(m, true); err != nil {
		return err
	}
	m.Debug("Unlocked device keys")

	m.Debug("LoginWithPaperkey success, sending login notification")
	m.G().NotifyRouter.HandleLogin(m.Ctx(), string(m.G().Env.GetUsername()))
	m.Debug("LoginWithPaperkey success, calling login hooks")
	m.G().CallLoginHooks(m)

	return nil
}
869432
func (bsd *bsdRecord) Run(e Executable) (string, error) {
	runAction := "Running " + bsd.description + ":"
	e.Run()
	return runAction + " completed.", nil
}
695468
func (c *Cron) Run() {
	if c.running {
		return
	}
	c.running = true
	c.run()
}
926414
func (eng *Engine) Run() error {
	defer eng.free()
	eng.transport.Bind(eng.connection)
	eng.tick() // Start ticking if needed
	for eng.dispatch() {
		// Initiate read/write if needed
		eng.read()
		eng.write()
		select {
		case f := <-eng.inject: // User or IO action
			f()
		case <-eng.timer.C:
			eng.tick()
		}
	}
	eng.err.Set(EndpointError(eng.Connection()))
	eng.err.Set(eng.Transport().Condition().Error())
	close(eng.running)   // Signal goroutines have exited and Error is set, disable Inject()
	_ = eng.conn.Close() // Close conn, force read goroutine to exit (Inject will fail)
	return eng.err.Get()
}
976022
func (e *Runner) Run(args []string) error {
	e.prepareForExecution()

	// determine which phase should be run according to RunnerOptions
	phaseRunFlags, err := e.computePhaseRunFlags()
	if err != nil {
		return err
	}

	// builds the runner data
	var data RunData
	if data, err = e.InitData(args); err != nil {
		return err
	}

	err = e.visitAll(func(p *phaseRunner) error {
		// if the phase should not be run, skip the phase.
		if run, ok := phaseRunFlags[p.generatedName]; !run || !ok {
			return nil
		}

		// Errors if phases that are meant to create special subcommands only
		// are wrongly assigned Run Methods
		if p.RunAllSiblings && (p.RunIf != nil || p.Run != nil) {
			return errors.Wrapf(err, "phase marked as RunAllSiblings can not have Run functions %s", p.generatedName)
		}

		// If the phase defines a condition to be checked before executing the phase action.
		if p.RunIf != nil {
			// Check the condition and returns if the condition isn't satisfied (or fails)
			ok, err := p.RunIf(data)
			if err != nil {
				return errors.Wrapf(err, "error execution run condition for phase %s", p.generatedName)
			}

			if !ok {
				return nil
			}
		}

		// Runs the phase action (if defined)
		if p.Run != nil {
			if err := p.Run(data); err != nil {
				return errors.Wrapf(err, "error execution phase %s", p.generatedName)
			}
		}

		return nil
	})

	return err
}
496263
func (ec *ServiceManager) Run() (err error) {

	// Launch services
	for _, s := range ec.services {
		ec.wg.Add(1)
		go ec.execute(s)
	}

	// Start event loop
	go ec.eventLoop()

	return nil
}
198515
func Run(w io.Writer, appArgs []string, ask prompt.Prompt) (help.HelpMessage, error) {
	r := &runner{}
	return r.run(w, appArgs, ask)
}
400288
func (example *Example) Run() {
	example.Started()
	example.Evaluate()
	if !example.HasFailure {
		example.Succeeded()
	}
	previousExample = example
}
1311856
func (c *Complete) Run() bool {
	c.AddFlags(nil)
	flag.Parse()
	return c.Complete()
}
1105197
func (a *machineAgentCmd) Run(c *cmd.Context) error {
	config := a.currentConfig.CurrentConfig()
	isCaasMachineAgent := config.Value(agent.ProviderType) == k8sprovider.CAASProviderType
	machineAgent, err := a.machineAgentFactory(a.machineId, isCaasMachineAgent)
	if err != nil {
		return errors.Trace(err)
	}
	return machineAgent.Run(c)
}
918699
func (s *Service) Run(c context.Context, f func(context.Context) error) {
	// Log to Stdout using JSON log lines.
	c = teelogger.Use(c, gkelogger.GetFactory(os.Stdout))

	// If a service name isn't specified, default to the base of the current
	// executable.
	if s.Name == "" {
		s.Name = filepath.Base(os.Args[0])
	}
	s.useDatastoreConfig = true // If available, use datastore config.

	rc := 0
	if err := s.runImpl(c, f); err != nil {
		log.WithError(err).Errorf(c, "Application exiting with error.")
		rc = 1
	}
	os.Exit(rc)
}
810148
func (e *PerUserKeyUpkeep) Run(m libkb.MetaContext) (err error) {
	defer m.Trace("PerUserKeyUpkeep", func() error { return err })()
	return e.inner(m)
}
577572
func (s *StepperDriver) Run() (err error) {
	//halt if already moving
	if s.moving == true {
		s.Halt()
	}

	s.mutex.Lock()
	s.moving = true
	s.mutex.Unlock()

	go func() {
		for {
			if s.moving == false {
				break
			}
			s.step()
		}
	}()

	return
}
465836
func (c *Client) Run(run params.RunParams) ([]params.ActionResult, error) {
	var results params.ActionResults
	err := c.facade.FacadeCall("Run", run, &results)
	return results.Results, err
}
393355
func (s *Server) Run() {
	go s.updater()
	go s.notifier()
	go s.manager()

	<-s.quit
}
202045
func (svc *AsyncService) Run() error {
	for {
		e, open := <-svc.c
		if open {
			// Call event handler
			svc.i.HandleEvent(e)
		} else {
			// Exit runner
			break
		}
	}
	return nil
}
997217
func (a *agent) Run() error {
	if err := a.Start(); err != nil {
		return err
	}
	return a.Wait()
}