aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--run-command.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/run-command.c b/run-command.c
index 32c290ee6a..574d5c40f0 100644
--- a/run-command.c
+++ b/run-command.c
@@ -1895,14 +1895,19 @@ void run_processes_parallel(const struct run_process_parallel_opts *opts)
"max:%"PRIuMAX,
(uintmax_t)opts->processes);
+ pp_init(&pp, opts, &pp_sig);
+
/*
* Child tasks might receive input via stdin, terminating early (or not), so
* ignore the default SIGPIPE which gets handled by each feed_pipe_fn which
* actually writes the data to children stdin fds.
+ *
+ * This _must_ come after pp_init(), because it installs its own
+ * SIGPIPE handler (to cleanup children), and we want to supersede
+ * that.
*/
sigchain_push(SIGPIPE, SIG_IGN);
- pp_init(&pp, opts, &pp_sig);
while (1) {
for (i = 0;
i < spawn_cap && !pp.shutdown &&
@@ -1928,10 +1933,10 @@ void run_processes_parallel(const struct run_process_parallel_opts *opts)
}
}
- pp_cleanup(&pp, opts);
-
sigchain_pop(SIGPIPE);
+ pp_cleanup(&pp, opts);
+
if (do_trace2)
trace2_region_leave(tr2_category, tr2_label, NULL);
}