MCPcopy Create free account
hub / github.com/git/git / test_stdin_pipe_feed

Function test_stdin_pipe_feed

t/helper/test-run-command.c:85–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85static int test_stdin_pipe_feed(int hook_stdin_fd, void *cb UNUSED, void *task_cb)
86{
87 int *lines_remaining = task_cb;
88
89 if (*lines_remaining) {
90 struct strbuf buf = STRBUF_INIT;
91 strbuf_addf(&buf, "sample stdin %d\n", --(*lines_remaining));
92 if (write_in_full(hook_stdin_fd, buf.buf, buf.len) < 0) {
93 if (errno == EPIPE) {
94 /* child closed stdin, nothing more to do */
95 strbuf_release(&buf);
96 return 1;
97 }
98 die_errno("write");
99 }
100 strbuf_release(&buf);
101 }
102
103 return !(*lines_remaining);
104}
105
106struct testsuite {
107 struct string_list tests, failed;

Callers

nothing calls this directly

Calls 4

strbuf_addfFunction · 0.85
write_in_fullFunction · 0.85
strbuf_releaseFunction · 0.85
die_errnoFunction · 0.85

Tested by

no test coverage detected