MCPcopy
hub / github.com/alexellis/k3sup / ExecuteStdio

Method ExecuteStdio

pkg/operator/exec_operator.go:13–30  ·  view source on GitHub ↗
(command string, stream bool)

Source from the content-addressed store, hash-verified

11}
12
13func (ex ExecOperator) ExecuteStdio(command string, stream bool) (CommandRes, error) {
14 task := goexecute.ExecTask{
15 Command: command,
16 Shell: true,
17 StreamStdio: stream,
18 }
19
20 res, err := task.Execute(context.Background())
21 if err != nil {
22 return CommandRes{}, err
23 }
24
25 return CommandRes{
26 StdErr: []byte(res.Stderr),
27 StdOut: []byte(res.Stdout),
28 ExitCode: res.ExitCode,
29 }, nil
30}
31
32func (ex ExecOperator) Execute(command string) (CommandRes, error) {
33 return ex.ExecuteStdio(command, true)

Callers 1

ExecuteMethod · 0.95

Calls 1

ExecuteMethod · 0.65

Tested by

no test coverage detected