MCPcopy
hub / github.com/git-lfs/git-lfs / BufferedExec

Function BufferedExec

subprocess/subprocess.go:22–51  ·  view source on GitHub ↗

BufferedExec starts up a command and creates a stdin pipe and a buffered stdout & stderr pipes, wrapped in a BufferedCmd. The stdout buffer will be of stdoutBufSize bytes.

(name string, args ...string)

Source from the content-addressed store, hash-verified

20// stdout & stderr pipes, wrapped in a BufferedCmd. The stdout buffer will be
21// of stdoutBufSize bytes.
22func BufferedExec(name string, args ...string) (*BufferedCmd, error) {
23 cmd, err := ExecCommand(name, args...)
24 if err != nil {
25 return nil, err
26 }
27 stdout, err := cmd.StdoutPipe()
28 if err != nil {
29 return nil, err
30 }
31 stderr, err := cmd.StderrPipe()
32 if err != nil {
33 return nil, err
34 }
35
36 stdin, err := cmd.StdinPipe()
37 if err != nil {
38 return nil, err
39 }
40
41 if err := cmd.Start(); err != nil {
42 return nil, err
43 }
44
45 return &BufferedCmd{
46 cmd,
47 stdin,
48 bufio.NewReaderSize(stdout, stdoutBufSize),
49 bufio.NewReaderSize(stderr, stdoutBufSize),
50 }, nil
51}
52
53// StdoutBufferedExec starts up a command and creates a stdin pipe and a
54// buffered stdout pipe, with stderr directed to /dev/null, wrapped in a

Callers 2

gitNoLFSBufferedFunction · 0.92
gitBufferedFunction · 0.92

Calls 5

StdoutPipeMethod · 0.80
StderrPipeMethod · 0.80
StdinPipeMethod · 0.80
ExecCommandFunction · 0.70
StartMethod · 0.45

Tested by

no test coverage detected