MCPcopy Index your code
hub / github.com/DarthSim/overmind / Run

Method Run

cmd_run.go:14–49  ·  view source on GitHub ↗
(c *cli.Context)

Source from the content-addressed store, hash-verified

12type cmdRunHandler struct{}
13
14func (h *cmdRunHandler) Run(c *cli.Context) error {
15 if !c.Args().Present() {
16 utils.Fatal("Specify a command to run")
17 }
18
19 command := c.Args()[0]
20
21 var args []string
22
23 if c.NArg() > 1 {
24 args = c.Args()[1:]
25 } else {
26 args = []string{}
27 }
28
29 cmd := exec.Command(command, args...)
30 cmd.Stdout = os.Stdout
31 cmd.Stderr = os.Stderr
32 cmd.Stdin = os.Stdin
33
34 err := cmd.Run()
35
36 if err != nil {
37 if exitErr, ok := err.(*exec.ExitError); ok {
38 if status, ok := exitErr.Sys().(syscall.WaitStatus); ok {
39 os.Exit(status.ExitStatus())
40 } else {
41 os.Exit(1)
42 }
43 } else {
44 utils.Fatal(err)
45 }
46 }
47
48 return nil
49}

Callers 2

mainFunction · 0.45
RunCmdFunction · 0.45

Calls 1

FatalFunction · 0.92

Tested by

no test coverage detected