MCPcopy Create free account
hub / github.com/sinclairtarget/git-who / StdoutLines

Method StdoutLines

internal/git/cmd/subprocess.go:59–82  ·  view source on GitHub ↗

Returns a single-use iterator over the output of the command, line by line.

()

Source from the content-addressed store, hash-verified

57
58// Returns a single-use iterator over the output of the command, line by line.
59func (s Subprocess) StdoutLines() (iter.Seq[string], func() error) {
60 var iterErr error
61
62 seq := func(yield func(string) bool) {
63 scanner := bufio.NewScanner(s.stdout)
64 for scanner.Scan() {
65 if !yield(scanner.Text()) {
66 return
67 }
68 }
69
70 iterErr = scanner.Err()
71 }
72
73 finish := func() error {
74 if iterErr != nil {
75 iterErr = fmt.Errorf("error while scanning: %w", iterErr)
76 }
77
78 return iterErr
79 }
80
81 return seq, finish
82}
83
84// Returns a single-use iterator over the output from git log.
85//

Callers 2

RevListFunction · 0.80
ParseArgsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected