// runcgo2 invokes the cgo tool to create _cgo_import.go
331241
func runcgo2(pkg *Package, dynout, ofile string) error {
	cgo := cgotool(pkg.Context)
	workdir := cgoworkdir(pkg)

	args := []string{
		"-objdir", workdir,
	}
	switch {
	case version.Version > 1.5:
		args = append(args,
			"-dynpackage", pkg.Name,
			"-dynimport", ofile,
			"-dynout", dynout,
		)
	default:
		return errors.Errorf("unsuppored Go version: %v", runtime.Version())
	}
	var buf bytes.Buffer
	err := runOut(&buf, pkg.Dir, nil, cgo, args...)
	if err != nil {
		fmt.Fprintf(os.Stderr, "# %s\n", pkg.ImportPath)
		io.Copy(os.Stderr, &buf)
	}
	return err
}
490361
func runApp(c *model.CommandConfig) (err error) {
	if c.Run.Mode == "" {
		c.Run.Mode = "dev"
	}

	revel_path, err := model.NewRevelPaths(c.Run.Mode, c.ImportPath, "", model.NewWrappedRevelCallback(nil, c.PackageResolver))
	if err != nil {
		return utils.NewBuildIfError(err, "Revel paths")
	}
	if c.Run.Port > -1 {
		revel_path.HTTPPort = c.Run.Port
	} else {
		c.Run.Port = revel_path.HTTPPort
	}

	utils.Logger.Infof("Running %s (%s) in %s mode\n", revel_path.AppName, revel_path.ImportPath, revel_path.RunMode)
	utils.Logger.Debug("Base path:", "path", revel_path.BasePath)

	// If the app is run in "watched" mode, use the harness to run it.
	if revel_path.Config.BoolDefault("watch", true) && revel_path.Config.BoolDefault("watch.code", true) {
		utils.Logger.Info("Running in watched mode.")
		runMode := fmt.Sprintf(`{"mode":"%s", "specialUseFlag":%v}`, revel_path.RunMode, c.Verbose)
		if c.HistoricMode {
			runMode = revel_path.RunMode
		}
		// **** Never returns.
		harness.NewHarness(c, revel_path, runMode, c.Run.NoProxy).Run()
	}

	// Else, just build and run the app.
	utils.Logger.Debug("Running in live build mode.")
	app, err := harness.Build(c, revel_path)
	if err != nil {
		utils.Logger.Errorf("Failed to build app: %s", err)
	}
	app.Port = revel_path.HTTPPort
	runMode := fmt.Sprintf(`{"mode":"%s", "specialUseFlag":%v}`, app.Paths.RunMode, c.Verbose)
	if c.HistoricMode {
		runMode = revel_path.RunMode
	}
	app.Cmd(runMode).Run()
	return
}
1284868
func GoRuntime() Setter {
	return func(node *v1.Node) error {
		node.Status.NodeInfo.OperatingSystem = goruntime.GOOS
		node.Status.NodeInfo.Architecture = goruntime.GOARCH
		return nil
	}
}
205071
func (d *domainClient) RunScript(ctx context.Context, args *RunScriptArgs) (reply *RunScriptReply, err error) {
	reply = new(RunScriptReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "Runtime.runScript", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "Runtime.runScript", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "Runtime", Op: "RunScript", Err: err}
	}
	return
}
806956
func Run(ctx context.Context, cfg Config, newTeleport NewProcess) error {
	if newTeleport == nil {
		newTeleport = newTeleportProcess
	}
	copyCfg := cfg
	srv, err := newTeleport(&copyCfg)
	if err != nil {
		return trace.Wrap(err, "initialization failed")
	}
	if srv == nil {
		return trace.BadParameter("process has returned nil server")
	}
	if err := srv.Start(); err != nil {
		return trace.Wrap(err, "startup failed")
	}
	// Wait and reload until called exit.
	for {
		srv, err = waitAndReload(ctx, cfg, srv, newTeleport)
		if err != nil {
			// This error means that was a clean shutdown
			// and no reload is necessary.
			if err == ErrTeleportExited {
				return nil
			}
			return trace.Wrap(err)
		}
	}
}
190477
func (o *UndoOptions) RunUndo() error {
	r := o.Builder().
		WithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...).
		NamespaceParam(o.Namespace).DefaultNamespace().
		FilenameParam(o.EnforceNamespace, &o.FilenameOptions).
		ResourceTypeOrNameArgs(true, o.Resources...).
		ContinueOnError().
		Latest().
		Flatten().
		Do()
	if err := r.Err(); err != nil {
		return err
	}

	err := r.Visit(func(info *resource.Info, err error) error {
		if err != nil {
			return err
		}
		rollbacker, err := polymorphichelpers.RollbackerFn(o.RESTClientGetter, info.ResourceMapping())
		if err != nil {
			return err
		}

		result, err := rollbacker.Rollback(info.Object, nil, o.ToRevision, o.DryRun)
		if err != nil {
			return err
		}

		printer, err := o.ToPrinter(result)
		if err != nil {
			return err
		}

		return printer.PrintObj(info.Object, o.Out)
	})

	return err
}
276681
func (h OsHelperImpl) RunCommand(executable string, args ...string) (string, error) {
	cmd := exec.Command(executable, args...)
	out, err := cmd.CombinedOutput()
	if err != nil {
		return string(out), err
	}
	return string(out), nil
}
1367976
func (o *Options) runLoop() error {
	if o.watcher != nil {
		o.watcher.Run()
	}

	// run the proxy in goroutine
	go func() {
		err := o.proxyServer.Run()
		o.errCh <- err
	}()

	for {
		select {
		case err := <-o.errCh:
			if err != nil {
				return err
			}
		}
	}
}
801581
func RunPrecompiledContract(p PrecompiledContract, input []byte, contract *Contract) (ret []byte, err error) {
	gas := p.RequiredGas(input)
	if contract.UseGas(gas) {
		return p.Run(input)
	}
	return nil, ErrOutOfGas
}
1032667
func (r *multiModelRunner) RunTransaction(tx *jujutxn.Transaction) error {
	if len(tx.Ops) == 0 {
		stack := shortStack()
		// It is a warning that should be reported to us, but we definitely
		// don't want to clutter up logs so we'll only write it once.
		if !seenShortStacks[stack] {
			seenShortStacks[stack] = true
			logger.Warningf("Running no-op transaction - called by %s", stack)
		}
	}
	newOps, err := r.updateOps(tx.Ops)
	if err != nil {
		return errors.Trace(err)
	}
	tx.Ops = newOps
	return r.rawRunner.RunTransaction(tx)
}
746786
func (c *importKeysCommand) Run(context *cmd.Context) error {
	client, err := c.NewKeyManagerClient()
	if err != nil {
		return err
	}
	defer client.Close()

	// TODO(alexisb) - currently keys are global which is not ideal.
	// keymanager needs to be updated to allow keys per user
	c.user = "admin"
	results, err := client.ImportKeys(c.user, c.sshKeyIds...)
	if err != nil {
		return block.ProcessBlockedError(err, block.BlockChange)
	}
	for i, result := range results {
		if result.Error != nil {
			fmt.Fprintf(context.Stderr, "cannot import key id %q: %v\n", c.sshKeyIds[i], result.Error)
		}
	}
	return nil
}
35546
func _runInstances(e *ec2.EC2, ctx context.ProviderCallContext, ri *ec2.RunInstances, c environs.StatusCallbackFunc) (resp *ec2.RunInstancesResp, err error) {
	try := 1
	for a := shortAttempt.Start(); a.Next(); {
		c(status.Allocating, fmt.Sprintf("Start instance attempt %d", try), nil)
		resp, err = e.RunInstances(ri)
		if err == nil || !isNotFoundError(err) {
			break
		}
		try++
	}
	return resp, maybeConvertCredentialError(err, ctx)
}
348164
func (o *ConvertOptions) RunConvert() error {

	// Convert must be removed from kubectl, since kubectl can not depend on
	// Kubernetes "internal" dependencies. These "internal" dependencies can
	// not be removed from convert. Another way to convert a resource is to
	// "kubectl apply" it to the cluster, then "kubectl get" at the desired version.
	// Another possible solution is to make convert a plugin.
	fmt.Fprintf(o.ErrOut, "kubectl convert is DEPRECATED and will be removed in a future version.\nIn order to convert, kubectl apply the object to the cluster, then kubectl get at the desired version.\n")

	b := o.builder().
		WithScheme(scheme.Scheme).
		LocalParam(o.local)
	if !o.local {
		schema, err := o.validator()
		if err != nil {
			return err
		}
		b.Schema(schema)
	}

	r := b.NamespaceParam(o.Namespace).
		ContinueOnError().
		FilenameParam(false, &o.FilenameOptions).
		Flatten().
		Do()

	err := r.Err()
	if err != nil {
		return err
	}

	singleItemImplied := false
	infos, err := r.IntoSingleItemImplied(&singleItemImplied).Infos()
	if err != nil {
		return err
	}

	if len(infos) == 0 {
		return fmt.Errorf("no objects passed to convert")
	}

	var specifiedOutputVersion schema.GroupVersion
	if len(o.OutputVersion) > 0 {
		specifiedOutputVersion, err = schema.ParseGroupVersion(o.OutputVersion)
		if err != nil {
			return err
		}
	}

	internalEncoder := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...)
	internalVersionJSONEncoder := unstructured.JSONFallbackEncoder{Encoder: internalEncoder}
	objects, err := asVersionedObject(infos, !singleItemImplied, specifiedOutputVersion, internalVersionJSONEncoder)
	if err != nil {
		return err
	}

	return o.Printer.PrintObj(objects, o.Out)
}
772496
func rungcc1(pkg *Package, cgoCFLAGS []string, ofile, cfile string) error {
	args := []string{"-g", "-O2",
		"-I", pkg.Dir,
		"-I", filepath.Dir(ofile),
	}
	args = append(args, cgoCFLAGS...)
	args = append(args,
		"-o", ofile,
		"-c", cfile,
	)
	t0 := time.Now()
	gcc := gccCmd(pkg, pkg.Dir)
	var buf bytes.Buffer
	err := runOut(&buf, pkg.Dir, nil, gcc[0], append(gcc[1:], args...)...)
	if err != nil {
		fmt.Fprintf(os.Stderr, "# %s\n", pkg.ImportPath)
		io.Copy(os.Stderr, &buf)
	}
	pkg.Record(gcc[0], time.Since(t0))
	return err
}
21608
func cgo14(pkg *Package) (*Action, []string, []string, error) {

	// collect cflags and ldflags from the package
	// the environment, and pkg-config.
	cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoLDFLAGS := cflags(pkg, false)
	pcCFLAGS, pcLDFLAGS, err := pkgconfig(pkg)
	if err != nil {
		return nil, nil, nil, err
	}
	cgoCFLAGS = append(cgoCFLAGS, pcCFLAGS...)
	cgoLDFLAGS = append(cgoLDFLAGS, pcLDFLAGS...)

	runcgo1 := []*Action{
		&Action{
			Name: "runcgo1: " + pkg.ImportPath,
			Run:  func() error { return runcgo1(pkg, cgoCFLAGS, cgoLDFLAGS) },
		}}

	workdir := cgoworkdir(pkg)
	defun := filepath.Join(workdir, "_cgo_defun.o")
	rundefun := Action{
		Name: "cc: " + pkg.ImportPath + ": _cgo_defun_c",
		Deps: runcgo1,
		Run:  func() error { return pkg.tc.Cc(pkg, defun, filepath.Join(workdir, "_cgo_defun.c")) },
	}

	cgofiles := []string{filepath.Join(workdir, "_cgo_gotypes.go")}
	for _, f := range pkg.CgoFiles {
		cgofiles = append(cgofiles, filepath.Join(workdir, stripext(f)+".cgo1.go"))
	}
	cfiles := []string{
		filepath.Join(workdir, "_cgo_main.c"),
		filepath.Join(workdir, "_cgo_export.c"),
	}
	cfiles = append(cfiles, pkg.CFiles...)

	for _, f := range pkg.CgoFiles {
		cfiles = append(cfiles, filepath.Join(workdir, stripext(f)+".cgo2.c"))
	}

	cflags := append(cgoCPPFLAGS, cgoCFLAGS...)
	cxxflags := append(cgoCPPFLAGS, cgoCXXFLAGS...)
	gcc1, ofiles := cgocc(pkg, cflags, cxxflags, cfiles, pkg.CXXFiles, runcgo1...)
	ofiles = append(ofiles, pkg.SysoFiles...)
	ofile := filepath.Join(filepath.Dir(ofiles[0]), "_cgo_.o")
	gcc2 := Action{
		Name: "gccld: " + pkg.ImportPath + ": _cgo_.o",
		Deps: gcc1,
		Run:  func() error { return gccld(pkg, cgoCFLAGS, cgoLDFLAGS, ofile, ofiles) },
	}

	dynout := filepath.Join(workdir, "_cgo_import.c")
	imports := stripext(dynout) + ".o"
	runcgo2 := Action{
		Name: "runcgo2: " + pkg.ImportPath,
		Deps: []*Action{&gcc2},
		Run: func() error {
			if err := runcgo2(pkg, dynout, ofile); err != nil {
				return err
			}
			return pkg.tc.Cc(pkg, imports, dynout)
		},
	}

	allo := filepath.Join(filepath.Dir(ofiles[0]), "_all.o")
	action := Action{
		Name: "rungcc3: " + pkg.ImportPath,
		Deps: []*Action{&runcgo2, &rundefun},
		Run: func() error {
			return rungcc3(pkg, pkg.Dir, allo, ofiles[1:]) // skip _cgo_main.o
		},
	}
	return &action, []string{defun, imports, allo}, cgofiles, nil
}
1346471
func (cfg *cloudConfig) RemoveRunCmd(cmd string) {
	cfg.attrs["runcmd"] = removeStringFromSlice(cfg.RunCmds(), cmd)
}
694939
func (s *Service) RunCommand(command string, args ...string) error {
	cmd := s.commands[command]
	if cmd == nil {
		return fmt.Errorf("unknown command %q", command)
	}
	err := s.setup()
	if err != nil {
		return fmt.Errorf("error in setup: %v", err)
	}
	flagMap, args, err := parseArgs(cmd.Flags, args)
	if err != nil {
		return err
	}
	cmd.Run(&CommandContext{cmd, args, flagMap})
	return nil
}