set_error_routine(old_errfn);
}
- static void prepare_cmd(struct argv_array *out, const struct child_process *cmd)
+ static int prepare_cmd(struct argv_array *out, const struct child_process *cmd)
{
if (!cmd->argv[0])
- die("BUG: command is empty");
+ BUG("command is empty");
/*
* Add SHELL_PATH so in the event exec fails with ENOEXEC we can
EOF
>empty
- test_expect_success 'start_command reports ENOENT' '
+ test_expect_success 'start_command reports ENOENT (slash)' '
- test-run-command start-command-ENOENT ./does-not-exist
+ test-tool run-command start-command-ENOENT ./does-not-exist
'
- test-run-command start-command-ENOENT does-not-exist
+ test_expect_success 'start_command reports ENOENT (no slash)' '
++ test-tool run-command start-command-ENOENT does-not-exist
+ '
+
test_expect_success 'run_command can run a command' '
cat hello-script >hello.sh &&
chmod +x hello.sh &&
test_cmp empty err
'
- test_must_fail test-run-command run-command should-not-run
+ test_expect_success 'run_command is restricted to PATH' '
+ write_script should-not-run <<-\EOF &&
+ echo yikes
+ EOF
++ test_must_fail test-tool run-command run-command should-not-run
+ '
+
test_expect_success !MINGW 'run_command can run a script without a #! line' '
cat >hello <<-\EOF &&
cat hello-script