summaryrefslogtreecommitdiff
path: root/t/helper
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-10-12 23:02:21 +0200
committerJunio C Hamano <gitster@pobox.com>2022-10-12 14:12:40 -0700
commit7dd5762d9f3980a85f96dd9f143184dc2fa07275 (patch)
treed2643a3d17df72630e4f82c8463ef7965c6a46b1 /t/helper
parenta083f94c2198e10ddb0c79acccd6137c24afce5b (diff)
downloadgit-7dd5762d9f3980a85f96dd9f143184dc2fa07275.tar.gz
run-command API: have "run_processes_parallel{,_tr2}()" return void
Change the "run_processes_parallel{,_tr2}()" functions to return void, instead of int. Ever since c553c72eed6 (run-command: add an asynchronous parallel child processor, 2015-12-15) they have unconditionally returned 0. To get a "real" return value out of this function the caller needs to get it via the "task_finished_fn" callback, see the example in hook.c added in 96e7225b310 (hook: add 'run' subcommand, 2021-12-22). So the "result = " and "if (!result)" code added to "builtin/fetch.c" d54dea77dba (fetch: let --jobs=<n> parallelize --multiple, too, 2019-10-05) has always been redundant, we always took that "if" path. Likewise the "ret =" in "t/helper/test-run-command.c" added in be5d88e1128 (test-tool run-command: learn to run (parts of) the testsuite, 2019-10-04) wasn't used, instead we got the return value from the "if (suite.failed.nr > 0)" block seen in the context. Subsequent commits will alter this API interface, getting rid of this always-zero return value makes it easier to understand those changes. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper')
-rw-r--r--t/helper/test-run-command.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c
index 390fa4fb72..30c474f324 100644
--- a/t/helper/test-run-command.c
+++ b/t/helper/test-run-command.c
@@ -192,8 +192,8 @@ static int testsuite(int argc, const char **argv)
fprintf(stderr, "Running %"PRIuMAX" tests (%d at a time)\n",
(uintmax_t)suite.tests.nr, max_jobs);
- ret = run_processes_parallel(max_jobs, next_test, test_failed,
- test_finished, &suite);
+ run_processes_parallel(max_jobs, next_test, test_failed,
+ test_finished, &suite);
if (suite.failed.nr > 0) {
ret = 1;
@@ -428,16 +428,16 @@ int cmd__run_command(int argc, const char **argv)
strvec_pushv(&proc.args, (const char **)argv + 3);
if (!strcmp(argv[1], "run-command-parallel")) {
- exit(run_processes_parallel(jobs, parallel_next,
- NULL, NULL, &proc));
+ run_processes_parallel(jobs, parallel_next, NULL, NULL, &proc);
} else if (!strcmp(argv[1], "run-command-abort")) {
- exit(run_processes_parallel(jobs, parallel_next,
- NULL, task_finished, &proc));
+ run_processes_parallel(jobs, parallel_next, NULL,
+ task_finished, &proc);
} else if (!strcmp(argv[1], "run-command-no-jobs")) {
- exit(run_processes_parallel(jobs, no_job,
- NULL, task_finished, &proc));
+ run_processes_parallel(jobs, no_job, NULL, task_finished,
+ &proc);
} else {
fprintf(stderr, "check usage\n");
return 1;
}
+ exit(0);
}