Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/run-command.c b/run-command.c
index 620a06ca2f..99dc93e730 100644
--- a/run-command.c
+++ b/run-command.c
@@ -380,7 +380,7 @@ static void child_err_spew(struct child_process *cmd, struct child_err *cerr)
switch (cerr->err) {
case CHILD_ERR_CHDIR:
error_errno("exec '%s': cd to '%s' failed",
- cmd->argv[0], cmd->dir);
+ cmd->args.v[0], cmd->dir);
break;
case CHILD_ERR_DUP2:
error_errno("dup2() in child failed");
@@ -392,12 +392,12 @@ static void child_err_spew(struct child_process *cmd, struct child_err *cerr)
error_errno("sigprocmask failed restoring signals");
break;
case CHILD_ERR_ENOENT:
- error_errno("cannot run %s", cmd->argv[0]);
+ error_errno("cannot run %s", cmd->args.v[0]);
break;
case CHILD_ERR_SILENT:
break;
case CHILD_ERR_ERRNO:
- error_errno("cannot exec '%s'", cmd->argv[0]);
+ error_errno("cannot exec '%s'", cmd->args.v[0]);
break;
}
set_error_routine(old_errfn);
@@ -405,7 +405,7 @@ static void child_err_spew(struct child_process *cmd, struct child_err *cerr)
static int prepare_cmd(struct strvec *out, const struct child_process *cmd)
{
- if (!cmd->argv[0])
+ if (!cmd->args.v[0])
BUG("command is empty");
/*
@@ -415,11 +415,11 @@ static int prepare_cmd(struct strvec *out, const struct child_process *cmd)
strvec_push(out, SHELL_PATH);
if (cmd->git_cmd) {
- prepare_git_cmd(out, cmd->argv);
+ prepare_git_cmd(out, cmd->args.v);
} else if (cmd->use_shell) {
- prepare_shell_cmd(out, cmd->argv);
+ prepare_shell_cmd(out, cmd->args.v);
} else {
- strvec_pushv(out, cmd->argv);
+ strvec_pushv(out, cmd->args.v);
}
/*
@@ -663,7 +663,7 @@ static void trace_run_command(const struct child_process *cp)
trace_add_env(&buf, cp->env);
if (cp->git_cmd)
strbuf_addstr(&buf, " git");
- sq_quote_argv_pretty(&buf, cp->argv);
+ sq_quote_argv_pretty(&buf, cp->args.v);
trace_printf("%s", buf.buf);
strbuf_release(&buf);
@@ -676,8 +676,6 @@ int start_command(struct child_process *cmd)
int failed_errno;
char *str;
- if (!cmd->argv)
- cmd->argv = cmd->args.v;
if (!cmd->env)
cmd->env = cmd->env_array.v;
@@ -729,7 +727,7 @@ int start_command(struct child_process *cmd)
str = "standard error";
fail_pipe:
error("cannot create %s pipe for %s: %s",
- str, cmd->argv[0], strerror(failed_errno));
+ str, cmd->args.v[0], strerror(failed_errno));
child_process_clear(cmd);
errno = failed_errno;
return -1;
@@ -758,7 +756,7 @@ fail_pipe:
failed_errno = errno;
cmd->pid = -1;
if (!cmd->silent_exec_failure)
- error_errno("cannot run %s", cmd->argv[0]);
+ error_errno("cannot run %s", cmd->args.v[0]);
goto end_of_spawn;
}
@@ -868,7 +866,7 @@ fail_pipe:
}
atfork_parent(&as);
if (cmd->pid < 0)
- error_errno("cannot fork() for %s", cmd->argv[0]);
+ error_errno("cannot fork() for %s", cmd->args.v[0]);
else if (cmd->clean_on_exit)
mark_child_for_cleanup(cmd->pid, cmd);
@@ -885,7 +883,7 @@ fail_pipe:
* At this point we know that fork() succeeded, but exec()
* failed. Errors have been reported to our stderr.
*/
- wait_or_whine(cmd->pid, cmd->argv[0], 0);
+ wait_or_whine(cmd->pid, cmd->args.v[0], 0);
child_err_spew(cmd, &cerr);
failed_errno = errno;
cmd->pid = -1;
@@ -902,7 +900,7 @@ end_of_spawn:
#else
{
int fhin = 0, fhout = 1, fherr = 2;
- const char **sargv = cmd->argv;
+ const char **sargv = cmd->args.v;
struct strvec nargv = STRVEC_INIT;
if (cmd->no_stdin)
@@ -929,20 +927,20 @@ end_of_spawn:
fhout = dup(cmd->out);
if (cmd->git_cmd)
- cmd->argv = prepare_git_cmd(&nargv, cmd->argv);
+ cmd->args.v = prepare_git_cmd(&nargv, sargv);
else if (cmd->use_shell)
- cmd->argv = prepare_shell_cmd(&nargv, cmd->argv);
+ cmd->args.v = prepare_shell_cmd(&nargv, sargv);
- cmd->pid = mingw_spawnvpe(cmd->argv[0], cmd->argv, (char**) cmd->env,
+ cmd->pid = mingw_spawnvpe(cmd->args.v[0], cmd->args.v, (char**) cmd->env,
cmd->dir, fhin, fhout, fherr);
failed_errno = errno;
if (cmd->pid < 0 && (!cmd->silent_exec_failure || errno != ENOENT))
- error_errno("cannot spawn %s", cmd->argv[0]);
+ error_errno("cannot spawn %s", cmd->args.v[0]);
if (cmd->clean_on_exit && cmd->pid >= 0)
mark_child_for_cleanup(cmd->pid, cmd);
strvec_clear(&nargv);
- cmd->argv = sargv;
+ cmd->args.v = sargv;
if (fhin != 0)
close(fhin);
if (fhout != 1)
@@ -992,7 +990,7 @@ end_of_spawn:
int finish_command(struct child_process *cmd)
{
- int ret = wait_or_whine(cmd->pid, cmd->argv[0], 0);
+ int ret = wait_or_whine(cmd->pid, cmd->args.v[0], 0);
trace2_child_exit(cmd, ret);
child_process_clear(cmd);
invalidate_lstat_cache();
@@ -1001,7 +999,7 @@ int finish_command(struct child_process *cmd)
int finish_command_in_signal(struct child_process *cmd)
{
- int ret = wait_or_whine(cmd->pid, cmd->argv[0], 1);
+ int ret = wait_or_whine(cmd->pid, cmd->args.v[0], 1);
trace2_child_exit(cmd, ret);
return ret;
}