Skip to content

Commit 8324302

Browse files
committed
Merge branch 'jc/run-command-report-exec-failure-fix' into maint
A recent update accidentally squelched an error message when the run_command API failed to run a missing command, which has been corrected. * jc/run-command-report-exec-failure-fix: run-command: report exec failure
2 parents 916f56d + e5a329a commit 8324302

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

run-command.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,8 @@ int start_command(struct child_process *cmd)
728728
if (prepare_cmd(&argv, cmd) < 0) {
729729
failed_errno = errno;
730730
cmd->pid = -1;
731+
if (!cmd->silent_exec_failure)
732+
error_errno("cannot run %s", cmd->argv[0]);
731733
goto end_of_spawn;
732734
}
733735

t/t0061-run-command.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ cat >hello-script <<-EOF
1313
EOF
1414

1515
test_expect_success 'start_command reports ENOENT (slash)' '
16-
test-tool run-command start-command-ENOENT ./does-not-exist
16+
test-tool run-command start-command-ENOENT ./does-not-exist 2>err &&
17+
test_i18ngrep "\./does-not-exist" err
1718
'
1819

1920
test_expect_success 'start_command reports ENOENT (no slash)' '
20-
test-tool run-command start-command-ENOENT does-not-exist
21+
test-tool run-command start-command-ENOENT does-not-exist 2>err &&
22+
test_i18ngrep "does-not-exist" err
2123
'
2224

2325
test_expect_success 'run_command can run a command' '
@@ -33,7 +35,8 @@ test_expect_success 'run_command is restricted to PATH' '
3335
write_script should-not-run <<-\EOF &&
3436
echo yikes
3537
EOF
36-
test_must_fail test-tool run-command run-command should-not-run
38+
test_must_fail test-tool run-command run-command should-not-run 2>err &&
39+
test_i18ngrep "should-not-run" err
3740
'
3841

3942
test_expect_success !MINGW 'run_command can run a script without a #! line' '

0 commit comments

Comments
 (0)