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

Method Run

cmd_connect.go:21–58  ·  view source on GitHub ↗
(c *cli.Context)

Source from the content-addressed store, hash-verified

19}
20
21func (h *cmdConnectHandler) Run(c *cli.Context) error {
22 if c.NArg() > 1 {
23 utils.Fatal("Specify a single name of process")
24 }
25
26 conn, err := h.Dial()
27 utils.FatalOnErr(err)
28
29 fmt.Fprintf(conn, "get-connection %s\n", c.Args().First())
30
31 response, err := bufio.NewReader(conn).ReadString('\n')
32 utils.FatalOnErr(err)
33
34 response = strings.TrimSpace(response)
35 if response == "" {
36 utils.Fatal(fmt.Sprintf("Unknown process name: %s", c.Args().First()))
37 }
38
39 parts := strings.Split(response, " ")
40 if len(parts) < 2 {
41 utils.Fatal("Invalid server response")
42 }
43
44 args := []string{"-L", parts[0], "attach", "-t", parts[1]}
45
46 if h.ControlMode {
47 args = append([]string{"-CC"}, args...)
48 }
49
50 cmd := exec.Command("tmux", args...)
51 cmd.Stdout = os.Stdout
52 cmd.Stderr = os.Stderr
53 cmd.Stdin = os.Stdin
54
55 utils.FatalOnErr(cmd.Run())
56
57 return nil
58}

Callers

nothing calls this directly

Calls 3

FatalFunction · 0.92
FatalOnErrFunction · 0.92
DialMethod · 0.80

Tested by

no test coverage detected