diff options
author | Matthijs Kooijman <matthijs@stdin.nl> | 2008-06-12 12:53:35 +0000 |
---|---|---|
committer | Matthijs Kooijman <matthijs@stdin.nl> | 2008-06-12 12:53:35 +0000 |
commit | 1cc695efd710e32eff06a336cb5391c52488cd2c (patch) | |
tree | 457c700aedd8ef09728c2917016dde6d27d42f6b /llvm/lib/System/Win32/Program.inc | |
parent | caec17eab9955a9a4558f0d3000eb336f494220e (diff) | |
download | bcm5719-llvm-1cc695efd710e32eff06a336cb5391c52488cd2c.tar.gz bcm5719-llvm-1cc695efd710e32eff06a336cb5391c52488cd2c.zip |
Fix redirection of stderr in sys::Program::ExecuteAndWait. There was logic
error that caused it to redirect stderr to stdout too often.
This fix is applied identically to the win32 code as well, but that is
untested.
--Thi line, and those below, will be ignored--
M System/Unix/Program.inc
M System/Win32/Program.inc
llvm-svn: 52233
Diffstat (limited to 'llvm/lib/System/Win32/Program.inc')
-rw-r--r-- | llvm/lib/System/Win32/Program.inc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/System/Win32/Program.inc b/llvm/lib/System/Win32/Program.inc index 52eb9677ffb..7e97c7fb4a4 100644 --- a/llvm/lib/System/Win32/Program.inc +++ b/llvm/lib/System/Win32/Program.inc @@ -176,7 +176,14 @@ Program::ExecuteAndWait(const Path& path, MakeErrMsg(ErrMsg, "can't redirect stdout"); return -1; } - if (redirects[1] && redirects[2] && *(redirects[1]) != *(redirects[2])) { + if (redirects[1] && redirects[2] && *(redirects[1]) == *(redirects[2])) { + // If stdout and stderr should go to the same place, redirect stderr + // to the handle already open for stdout. + DuplicateHandle(GetCurrentProcess(), si.hStdOutput, + GetCurrentProcess(), &si.hStdError, + 0, TRUE, DUPLICATE_SAME_ACCESS); + } else { + // Just redirect stderr si.hStdError = RedirectIO(redirects[2], 2, ErrMsg); if (si.hStdError == INVALID_HANDLE_VALUE) { CloseHandle(si.hStdInput); @@ -184,10 +191,6 @@ Program::ExecuteAndWait(const Path& path, MakeErrMsg(ErrMsg, "can't redirect stderr"); return -1; } - } else { - DuplicateHandle(GetCurrentProcess(), si.hStdOutput, - GetCurrentProcess(), &si.hStdError, - 0, TRUE, DUPLICATE_SAME_ACCESS); } } |