summaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-03-04 13:46:30 -0800
committerJunio C Hamano <gitster@pobox.com>2016-03-04 13:46:30 -0800
commitbbe90e7950456bf1bb1ab17a9ee626f6fad7a7c6 (patch)
tree9492660cef03802ccee18d814bfed3d1aad5b1d5 /run-command.c
parent6dd0a37c34e79e38aa611fce10dd5609ccc7c39a (diff)
parent2a73b3dad09ef162eb5917e9e0d01d7c306f6b35 (diff)
downloadgit-bbe90e7950456bf1bb1ab17a9ee626f6fad7a7c6.tar.gz
Merge branch 'sb/submodule-parallel-fetch'
Simplify the two callback functions that are triggered when the child process terminates to avoid misuse of the child-process structure that has already been cleaned up. * sb/submodule-parallel-fetch: run-command: do not pass child process data into callbacks
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/run-command.c b/run-command.c
index 863dad52f1..c72601056c 100644
--- a/run-command.c
+++ b/run-command.c
@@ -902,35 +902,18 @@ struct parallel_processes {
struct strbuf buffered_output; /* of finished children */
};
-static int default_start_failure(struct child_process *cp,
- struct strbuf *err,
+static int default_start_failure(struct strbuf *err,
void *pp_cb,
void *pp_task_cb)
{
- int i;
-
- strbuf_addstr(err, "Starting a child failed:");
- for (i = 0; cp->argv[i]; i++)
- strbuf_addf(err, " %s", cp->argv[i]);
-
return 0;
}
static int default_task_finished(int result,
- struct child_process *cp,
struct strbuf *err,
void *pp_cb,
void *pp_task_cb)
{
- int i;
-
- if (!result)
- return 0;
-
- strbuf_addf(err, "A child failed with return code %d:", result);
- for (i = 0; cp->argv[i]; i++)
- strbuf_addf(err, " %s", cp->argv[i]);
-
return 0;
}
@@ -1048,8 +1031,7 @@ static int pp_start_one(struct parallel_processes *pp)
pp->children[i].process.no_stdin = 1;
if (start_command(&pp->children[i].process)) {
- code = pp->start_failure(&pp->children[i].process,
- &pp->children[i].err,
+ code = pp->start_failure(&pp->children[i].err,
pp->data,
&pp->children[i].data);
strbuf_addbuf(&pp->buffered_output, &pp->children[i].err);
@@ -1117,7 +1099,7 @@ static int pp_collect_finished(struct parallel_processes *pp)
code = finish_command(&pp->children[i].process);
- code = pp->task_finished(code, &pp->children[i].process,
+ code = pp->task_finished(code,
&pp->children[i].err, pp->data,
&pp->children[i].data);