MCPcopy Create free account
hub / github.com/convox/rack / Exec

Function Exec

pkg/cli/exec.go:21–45  ·  view source on GitHub ↗
(rack sdk.Interface, c *stdcli.Context)

Source from the content-addressed store, hash-verified

19}
20
21func Exec(rack sdk.Interface, c *stdcli.Context) error {
22 pid := c.Arg(0)
23 command := strings.Join(c.Args[1:], " ")
24
25 opts := structs.ProcessExecOptions{}
26
27 if w, h, err := c.TerminalSize(); err == nil {
28 opts.Height = options.Int(h)
29 opts.Width = options.Int(w)
30 }
31
32 if !stdcli.IsTerminal(os.Stdin) {
33 opts.Tty = options.Bool(false)
34 }
35
36 restore := c.TerminalRaw()
37 defer restore()
38
39 code, err := rack.ProcessExec(app(c), pid, command, c, opts)
40 if err != nil {
41 return err
42 }
43
44 return stdcli.Exit(code)
45}

Callers

nothing calls this directly

Calls 4

IntFunction · 0.92
BoolFunction · 0.92
appFunction · 0.85
ProcessExecMethod · 0.65

Tested by

no test coverage detected