| 440 | } |
| 441 | |
| 442 | int cmd__run_command(int argc, const char **argv) |
| 443 | { |
| 444 | struct child_process proc = CHILD_PROCESS_INIT; |
| 445 | int jobs; |
| 446 | int ret; |
| 447 | struct run_process_parallel_opts opts = { |
| 448 | .data = &proc, |
| 449 | }; |
| 450 | |
| 451 | if (argc > 1 && !strcmp(argv[1], "testsuite")) |
| 452 | return testsuite(argc - 1, argv + 1); |
| 453 | if (!strcmp(argv[1], "inherited-handle")) |
| 454 | return inherit_handle(argv[0]); |
| 455 | if (!strcmp(argv[1], "inherited-handle-child")) |
| 456 | return inherit_handle_child(); |
| 457 | |
| 458 | if (argc >= 2 && !strcmp(argv[1], "quote-stress-test")) |
| 459 | return !!quote_stress_test(argc - 1, argv + 1); |
| 460 | |
| 461 | if (argc >= 2 && !strcmp(argv[1], "quote-echo")) |
| 462 | return !!quote_echo(argc - 1, argv + 1); |
| 463 | |
| 464 | if (argc < 3) |
| 465 | return 1; |
| 466 | while (!strcmp(argv[1], "env")) { |
| 467 | if (!argv[2]) |
| 468 | die("env specifier without a value"); |
| 469 | strvec_push(&proc.env, argv[2]); |
| 470 | argv += 2; |
| 471 | argc -= 2; |
| 472 | } |
| 473 | if (argc < 3) { |
| 474 | ret = 1; |
| 475 | goto cleanup; |
| 476 | } |
| 477 | strvec_pushv(&proc.args, (const char **)argv + 2); |
| 478 | |
| 479 | if (!strcmp(argv[1], "start-command-ENOENT")) { |
| 480 | if (start_command(&proc) < 0 && errno == ENOENT) { |
| 481 | ret = 0; |
| 482 | goto cleanup; |
| 483 | } |
| 484 | fprintf(stderr, "FAIL %s\n", argv[1]); |
| 485 | return 1; |
| 486 | } |
| 487 | if (!strcmp(argv[1], "run-command")) { |
| 488 | ret = run_command(&proc); |
| 489 | goto cleanup; |
| 490 | } |
| 491 | |
| 492 | if (!strcmp(argv[1], "--ungroup")) { |
| 493 | argv += 1; |
| 494 | argc -= 1; |
| 495 | opts.ungroup = 1; |
| 496 | } |
| 497 | |
| 498 | jobs = atoi(argv[2]); |
| 499 | strvec_clear(&proc.args); |
nothing calls this directly
no test coverage detected