diff options
author | Nico Weber <nicolasweber@gmx.de> | 2017-06-14 21:49:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-14 21:49:35 (GMT) |
commit | 00f69c17951fee353068c3905b4dd4d08322fdd3 (patch) | |
tree | 1b4d09d7afde0b53f53b6d52efe3add7a815f5b3 /src/build.cc | |
parent | 0142023b82c9c8003eae43b4d98ea4bb4e3870f5 (diff) | |
parent | b0425804290dc25092a2af1a6a05a4f8238a8c93 (diff) | |
download | Ninja-00f69c17951fee353068c3905b4dd4d08322fdd3.zip Ninja-00f69c17951fee353068c3905b4dd4d08322fdd3.tar.gz Ninja-00f69c17951fee353068c3905b4dd4d08322fdd3.tar.bz2 |
Merge pull request #1156 from cdbennett/windows-binary-mode-output
Write subprocess output to stdout in binary mode
Diffstat (limited to 'src/build.cc')
-rw-r--r-- | src/build.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/build.cc b/src/build.cc index 1cce981..8f4169b 100644 --- a/src/build.cc +++ b/src/build.cc @@ -20,6 +20,11 @@ #include <stdlib.h> #include <functional> +#ifdef _WIN32 +#include <fcntl.h> +#include <io.h> +#endif + #if defined(__SVR4) && defined(__sun) #include <sys/termios.h> #endif @@ -155,7 +160,17 @@ void BuildStatus::BuildEdgeFinished(Edge* edge, final_output = StripAnsiEscapeCodes(output); else final_output = output; + +#ifdef _WIN32 + // Fix extra CR being added on Windows, writing out CR CR LF (#773) + _setmode(_fileno(stdout), _O_BINARY); // Begin Windows extra CR fix +#endif + printer_.PrintOnNewLine(final_output); + +#ifdef _WIN32 + _setmode(_fileno(stdout), _O_TEXT); // End Windows extra CR fix +#endif } } |