X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=run-command.c;h=7068ec7e6d74af0cec233259b4b6e41a61ed5123;hb=c30e699fc509f43f459c17d3148e7d866fb9157a;hp=743757c36ec0e5667fd8af28800ac095f1581adb;hpb=7ab9f8f8b12853d4cb0e45031bf2ee9a0517ad22;p=git.git diff --git a/run-command.c b/run-command.c index 743757c36..7068ec7e6 100644 --- a/run-command.c +++ b/run-command.c @@ -65,6 +65,8 @@ int start_command(struct child_process *cmd) cmd->err = fderr[0]; } + trace_argv_printf(cmd->argv, "trace: run_command:"); + cmd->pid = fork(); if (cmd->pid < 0) { if (need_in) @@ -91,6 +93,13 @@ int start_command(struct child_process *cmd) close(cmd->in); } + if (cmd->no_stderr) + dup_devnull(2); + else if (need_err) { + dup2(fderr[1], 2); + close_pair(fderr); + } + if (cmd->no_stdout) dup_devnull(1); else if (cmd->stdout_to_stderr) @@ -103,13 +112,6 @@ int start_command(struct child_process *cmd) close(cmd->out); } - if (cmd->no_stderr) - dup_devnull(2); - else if (need_err) { - dup2(fderr[1], 2); - close_pair(fderr); - } - if (cmd->dir && chdir(cmd->dir)) die("exec %s: cd to %s failed (%s)", cmd->argv[0], cmd->dir, strerror(errno));