ctest --launch: write to cout and cerr in binary
Because ctest reads in binary but writes in text mode, Windows' newline transformation can be applied multiple times causing '\n' in the source application to be written out as '\r\r\n' instead.
This commit is contained in:
parent
356f7cf445
commit
29b0c8c360
|
@ -21,6 +21,12 @@
|
|||
#include <cmsys/RegularExpression.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)
|
||||
{
|
||||
|
@ -259,6 +265,13 @@ void cmCTestLaunch::RunChild()
|
|||
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.
|
||||
cmsysProcess_Execute(cp);
|
||||
|
||||
|
|
Loading…
Reference in New Issue