diff options
author | Brad King <brad.king@kitware.com> | 2015-02-06 21:39:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-02-06 21:41:51 (GMT) |
commit | c6ada8275b680e02f50a7aee1c02b0b184cadf83 (patch) | |
tree | 64500ecd5dd3fe74cec6f447960c8de2443f5b08 /Source/cmSystemTools.cxx | |
parent | 8521fdf56e4908676c28c6bbdda3f1fb2284d3d7 (diff) | |
download | CMake-c6ada8275b680e02f50a7aee1c02b0b184cadf83.zip CMake-c6ada8275b680e02f50a7aee1c02b0b184cadf83.tar.gz CMake-c6ada8275b680e02f50a7aee1c02b0b184cadf83.tar.bz2 |
Makefile: Print all color escape sequences before newline
Ensure that the escape sequences do not leak across lines.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ec3d846..f50d16c 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2304,13 +2304,19 @@ void cmSystemTools::MakefileColorEcho(int color, const char* message, if(enabled) { - cmsysTerminal_cfprintf(color | assumeTTY, stdout, "%s%s", - message, newline? "\n" : ""); + // Print with color. Delay the newline until later so that + // all color restore sequences appear before it. + cmsysTerminal_cfprintf(color | assumeTTY, stdout, "%s", message); } else { // Color is disabled. Print without color. - fprintf(stdout, "%s%s", message, newline? "\n" : ""); + fprintf(stdout, "%s", message); + } + + if(newline) + { + fprintf(stdout, "\n"); } } |