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

Function pp_buffer_stdin

run-command.c:1691–1727  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1689}
1690
1691static void pp_buffer_stdin(struct parallel_processes *pp,
1692 const struct run_process_parallel_opts *opts)
1693{
1694 /* Buffer stdin for each pipe. */
1695 for (size_t i = 0; i < opts->processes; i++) {
1696 struct child_process *proc = &pp->children[i].process;
1697 int ret;
1698
1699 if (!child_is_receiving_input(&pp->children[i]))
1700 continue;
1701
1702 /*
1703 * child input is provided via path_to_stdin when the feed_pipe cb is
1704 * missing, so we just signal an EOF.
1705 */
1706 if (!opts->feed_pipe) {
1707 close(proc->in);
1708 proc->in = 0;
1709 continue;
1710 }
1711
1712 /**
1713 * Feed the pipe:
1714 * ret < 0 means error
1715 * ret == 0 means there is more data to be fed
1716 * ret > 0 means feeding finished
1717 */
1718 ret = opts->feed_pipe(proc->in, opts->data, pp->children[i].data);
1719 if (ret < 0)
1720 die_errno("feed_pipe");
1721
1722 if (ret) {
1723 close(proc->in);
1724 proc->in = 0;
1725 }
1726 }
1727}
1728
1729static void pp_buffer_io(struct parallel_processes *pp,
1730 const struct run_process_parallel_opts *opts,

Callers 1

pp_handle_child_IOFunction · 0.85

Calls 2

child_is_receiving_inputFunction · 0.85
die_errnoFunction · 0.85

Tested by

no test coverage detected