diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-03-07 10:53:10 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-03-07 10:53:10 -0800 |
commit | 792f0e7d1a156379fb71deb2e65c349c595a9202 (patch) | |
tree | 9eb99a272d923a3490be8e0f4cda3c6303f60859 /run-command.c | |
parent | bash: git-branch -d and -m lists only local branches (diff) | |
parent | run-command: Redirect stderr to a pipe before redirecting stdout to stderr (diff) | |
download | tgif-792f0e7d1a156379fb71deb2e65c349c595a9202.tar.xz |
Merge branch 'cc/run-command'
* cc/run-command:
run-command: Redirect stderr to a pipe before redirecting stdout to stderr
Diffstat (limited to 'run-command.c')
-rw-r--r-- | run-command.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/run-command.c b/run-command.c index 743757c36e..44100a749b 100644 --- a/run-command.c +++ b/run-command.c @@ -91,6 +91,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 +110,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)); |