@@ -1683,6 +1683,9 @@ static int pp_start_one(struct parallel_processes *pp)
if (i == pp->max_processes)
BUG("bookkeeping is hard");
+ /* disallow by default, but allow users to set up stdin if they wish */
+ pp->children[i].process.no_stdin = 1;
+
code = pp->get_next_task(&pp->children[i].process,
&pp->children[i].err,
pp->data,
@@ -1694,7 +1697,6 @@ static int pp_start_one(struct parallel_processes *pp)
}
pp->children[i].process.err = -1;
pp->children[i].process.stdout_to_stderr = 1;
- pp->children[i].process.no_stdin = 1;
if (start_command(&pp->children[i].process)) {
code = pp->start_failure(&pp->children[i].err,
While it makes sense not to inherit stdin from the parent process to avoid deadlocking, it's not necessary to completely ban stdin to children. An informed user should be able to configure stdin safely. By setting `some_child.process.no_stdin=1` before calling `get_next_task()` we provide a reasonable default behavior but enable users to set up stdin streaming for themselves during the callback. `some_child.process.stdout_to_stderr`, however, remains unmodifiable by `get_next_task()` - the rest of the run_processes_parallel() API depends on child output in stderr. Signed-off-by: Emily Shaffer <emilyshaffer@google.com> --- run-command.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)