Merge topic 'ctest-binary-pipe'

29b0c8c3 ctest --launch: write to cout and cerr in binary
This commit is contained in:
Brad King 2014-12-08 09:07:12 -05:00 committed by CMake Topic Stage
commit 79d1e1347a
1 changed files with 13 additions and 0 deletions

View File

@ -21,6 +21,12 @@
#include <cmsys/RegularExpression.hxx> #include <cmsys/RegularExpression.hxx>
#include <cmsys/FStream.hxx> #include <cmsys/FStream.hxx>
#ifdef _WIN32
#include <io.h> // for _setmode
#include <fcntl.h> // for _O_BINARY
#include <stdio.h> // for std{out,err} and fileno
#endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmCTestLaunch::cmCTestLaunch(int argc, const char* const* argv) cmCTestLaunch::cmCTestLaunch(int argc, const char* const* argv)
{ {
@ -259,6 +265,13 @@ void cmCTestLaunch::RunChild()
std::ios::out | std::ios::binary); std::ios::out | std::ios::binary);
} }
#ifdef _WIN32
// Do this so that newline transformation is not done when writing to cout
// and cerr below.
_setmode(fileno(stdout), _O_BINARY);
_setmode(fileno(stderr), _O_BINARY);
#endif
// Run the real command. // Run the real command.
cmsysProcess_Execute(cp); cmsysProcess_Execute(cp);