From d0e8078ae5fe00e29df772050a2c62fa5845e286 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Thu, 13 Mar 2008 13:17:42 +0100 Subject: [PATCH] Setup stderr before stdout on Windows as well. This implements what ce2cf27adc does on Unix. Signed-off-by: Johannes Sixt --- run-command.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/run-command.c b/run-command.c index aba2bf2c0f..2ce8c2b2f0 100644 --- a/run-command.c +++ b/run-command.c @@ -132,6 +132,14 @@ int start_command(struct child_process *cmd) dup2(cmd->in, 0); } + if (cmd->no_stderr) { + s2 = dup(2); + dup_devnull(2); + } else if (need_err) { + s2 = dup(2); + dup2(fderr[1], 2); + } + if (cmd->no_stdout) { s1 = dup(1); dup_devnull(1); @@ -146,14 +154,6 @@ int start_command(struct child_process *cmd) dup2(cmd->out, 1); } - if (cmd->no_stderr) { - s2 = dup(2); - dup_devnull(2); - } else if (need_err) { - s2 = dup(2); - dup2(fderr[1], 2); - } - if (cmd->dir) die("chdir in start_command() not implemented"); if (cmd->env) {