// Run runs the command to get operating systems.
978548
func (c *GetOSesCmd) Run(app subcommands.Application, args []string, env subcommands.Env) int {
	ctx := cli.GetContext(app, c, env)
	client := getClient(ctx)
	resp, err := client.ListOSes(ctx, &c.req)
	if err != nil {
		errors.Log(ctx, err)
		return 1
	}
	printOSes(c.f.tsv, resp.Oses...)
	return 0
}
1305494
func (c *CmdSimpleFSRead) Run() error {
	cli, err := GetSimpleFSClient(c.G())
	if err != nil {
		return err
	}

	ctx := context.TODO()

	opid, err2 := cli.SimpleFSMakeOpid(ctx)
	if err2 != nil {
		return err2
	}
	err = cli.SimpleFSOpen(ctx, keybase1.SimpleFSOpenArg{
		OpID:  opid,
		Dest:  c.path,
		Flags: keybase1.OpenFlags_READ | keybase1.OpenFlags_EXISTING,
	})
	if err != nil {
		return err
	}
	defer cli.SimpleFSClose(ctx, opid)
	var offset int64
	for {
		c.G().Log.Debug("SimpleFS: Reading at %d", offset)

		content, err := cli.SimpleFSRead(ctx, keybase1.SimpleFSReadArg{
			OpID:   opid,
			Offset: offset,
			Size:   c.bufSize,
		})
		if err != nil {
			return err
		}
		c.G().Log.Debug("SimpleFS: Read %d", len(content.Data))

		if len(content.Data) > 0 {
			offset += int64(len(content.Data))
			c.output(content.Data)
		} else {
			break
		}
	}

	return err
}
196784
func (c *CmdSimpleFSRemove) Run() error {
	cli, err := GetSimpleFSClient(c.G())
	if err != nil {
		return err
	}

	ctx := context.TODO()

	paths, err := doSimpleFSGlob(ctx, c.G(), cli, c.paths)
	if err != nil {
		return err
	}

	for _, path := range paths {
		opid, err2 := cli.SimpleFSMakeOpid(ctx)
		if err2 != nil {
			return err2
		}
		defer cli.SimpleFSClose(ctx, opid)
		c.G().Log.Debug("SimpleFSRemove %s", path.Kbfs())
		err = cli.SimpleFSRemove(ctx, keybase1.SimpleFSRemoveArg{
			OpID:      opid,
			Path:      path,
			Recursive: c.recurse,
		})
		if err != nil {
			break
		}
		err = cli.SimpleFSWait(ctx, opid)
		if err != nil {
			break
		}
	}
	return err
}
767562
func (t *terminal) Run() error {
	defer t.closeTTY()

	cmd, err := prepareInteractiveCommand(t.ctx)
	if err != nil {
		return trace.Wrap(err)
	}
	t.cmd = cmd

	cmd.Stdout = t.tty
	cmd.Stdin = t.tty
	cmd.Stderr = t.tty
	cmd.SysProcAttr.Setctty = true
	cmd.SysProcAttr.Setsid = true

	err = cmd.Start()
	if err != nil {
		return trace.Wrap(err)
	}

	return nil
}
125267
func Run(args ...string) (string, error) {
	// TODO: use exex.CommandContext here and refactor.
	var extraArgs = []string{
		"-c", "log.showSignature=false",
	}
	args = append(extraArgs, args...)
	/* #nosec */
	var cmd = exec.Command("git", args...)
	log.WithField("args", args).Debug("running git")
	bts, err := cmd.CombinedOutput()
	log.WithField("output", string(bts)).
		Debug("git result")
	if err != nil {
		return "", errors.New(string(bts))
	}
	return string(bts), nil
}
551106
func (c *upgradeSeriesCommand) Run(ctx *cmd.Context) error {
	if c.subCommand == PrepareCommand {
		err := c.UpgradeSeriesPrepare(ctx)
		if err != nil {
			return errors.Trace(err)
		}
	}
	if c.subCommand == CompleteCommand {
		err := c.UpgradeSeriesComplete(ctx)
		if err != nil {
			return errors.Trace(err)
		}
	}
	return nil
}
471899
func (cmd *createSnapshotCmd) Run(app subcommands.Application, args []string, env subcommands.Env) int {
	c := cli.GetContext(app, cmd, env)
	labels, err := cmd.validateFlags(c)
	if err != nil {
		logging.Errorf(c, "%s", err.Error())
		return 1
	}

	srv := getService(c)
	logging.Infof(c, "Creating snapshot.")
	snapshot := &compute.Snapshot{
		Labels: labels,
		Name:   cmd.name,
	}
	op, err := compute.NewDisksService(srv).CreateSnapshot(cmd.project, cmd.zone, cmd.disk, snapshot).Context(c).Do()
	for {
		if err != nil {
			for _, err := range err.(*googleapi.Error).Errors {
				logging.Errorf(c, "%s", err.Message)
			}
			return 1
		}
		if op.Status == "DONE" {
			break
		}
		logging.Infof(c, "Waiting for snapshot to be created...")
		time.Sleep(2 * time.Second)
		op, err = compute.NewZoneOperationsService(srv).Get(cmd.project, cmd.zone, op.Name).Context(c).Do()
	}
	if op.Error != nil {
		for _, err := range op.Error.Errors {
			logging.Errorf(c, "%s", err.Message)
		}
		return 1
	}
	logging.Infof(c, "Created snapshot.")
	return 0
}
1074073
func (kernel *Kernel) Run(_ ...uint) error {
	size := C.size_t(1)
	event := new(C.cl_event)

	errCode := C.clEnqueueNDRangeKernel(kernel.program.world.cw.command_queue, kernel.kernel, 1,
		nil, &size, &size, 0, nil, event)
	err := errorCode(errCode)
	if err != nil {
		return err
	}

	errCode = C.clFlush(kernel.program.world.cw.command_queue)
	err = errorCode(errCode)
	if err != nil {
		return err
	}

	errCode = C.clWaitForEvents(1, event)
	err = errorCode(errCode)
	return err
}
1104757
func (c *CmdSimpleFSPs) Run() error {
	cli, err := GetSimpleFSClient(c.G())
	if err != nil {
		return err
	}

	ops, err := cli.SimpleFSGetOps(context.TODO())

	c.output(ops)

	return err
}
82798
func run(stdout, stderr io.Writer, cmd string, args ...string) error {
	c := exec.Command(cmd, args...)
	c.Stdin = os.Stdin
	c.Stdout = stdout
	c.Stderr = stderr
	return c.Run()
}
50319
func (c *CmdGitMddel) Run() error {
	cli, err := GetGitClient(c.G())
	if err != nil {
		return err
	}

	folder, err := ParseTLF(c.folder)
	if err != nil {
		return err
	}

	return cli.DeleteGitMetadata(context.Background(), keybase1.DeleteGitMetadataArg{
		Folder:   folder,
		RepoName: keybase1.GitRepoName(c.repoName),
	})
}
627
func (c *deleteImageMetadataCommand) Run(ctx *cmd.Context) (err error) {
	api, err := c.newAPIFunc()
	if err != nil {
		return err
	}
	defer api.Close()

	err = api.Delete(c.ImageId)
	if err != nil {
		return err
	}
	return nil
}
901558
func (c *CmdSimpleFSKill) Run() error {
	cli, err := GetSimpleFSClient(c.G())
	if err != nil {
		return err
	}

	err = cli.SimpleFSClose(context.TODO(), c.opid)

	return err
}
1061117
func Run(id string, initFunc Init, opts ...BinaryOpts) {
	var config Config
	for _, o := range opts {
		o(&config)
	}
	if err := run(id, initFunc, config); err != nil {
		fmt.Fprintf(os.Stderr, "%s: %s\n", id, err)
		os.Exit(1)
	}
}
706202
func (c *GetRacksCmd) Run(app subcommands.Application, args []string, env subcommands.Env) int {
	ctx := cli.GetContext(app, c, env)
	client := getClient(ctx)
	resp, err := client.ListRacks(ctx, &c.req)
	if err != nil {
		errors.Log(ctx, err)
		return 1
	}
	printRacks(c.f.tsv, resp.Racks...)
	return 0
}
1115408
func Run(command string, args ...string) error {
	cmd := exec.Command(command, args...)
	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr

	return RunCommand(cmd, false)
}
1034747
func Run(name string, arg ...string) {
	pkgCmd = Command(name, arg...)
	pkgCmd.Run()
}