MCPcopy Index your code
hub / github.com/jetify-com/devbox / CommandTTYWithBuffer

Function CommandTTYWithBuffer

internal/cmdutil/exec.go:23–36  ·  view source on GitHub ↗

CommandTTYWithBuffer returns a command with stdin, stdout, and stderr and a buffer that contains stdout and stderr combined.

(
	name string,
	arg ...string,
)

Source from the content-addressed store, hash-verified

21// CommandTTYWithBuffer returns a command with stdin, stdout, and stderr
22// and a buffer that contains stdout and stderr combined.
23func CommandTTYWithBuffer(
24 name string,
25 arg ...string,
26) (*exec.Cmd, *bytes.Buffer) {
27 cmd := exec.Command(name, arg...)
28 cmd.Stdin = os.Stdin
29
30 errBuf := bytes.NewBuffer(nil)
31 outBuf := bytes.NewBuffer(nil)
32 cmd.Stderr = io.MultiWriter(os.Stderr, errBuf)
33 cmd.Stdout = io.MultiWriter(os.Stdout, outBuf)
34 outBuf.Write(errBuf.Bytes())
35 return cmd, outBuf
36}

Callers 1

createCommitFunction · 0.92

Calls 3

CommandMethod · 0.80
WriteMethod · 0.80
BytesMethod · 0.80

Tested by

no test coverage detected