summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/tools/driver/Driver.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 328b90beab4..c057d71a830 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -1037,7 +1037,12 @@ Driver::MainLoop ()
atexit (reset_stdin_termios);
}
+#ifndef _MSC_VER
+ // Disabling stdin buffering with MSVC's 2015 CRT exposes a bug in fgets
+ // which causes it to miss newlines depending on whether there have been an
+ // odd or even number of characters. Bug has been reported to MS via Connect.
::setbuf (stdin, NULL);
+#endif
::setbuf (stdout, NULL);
m_debugger.SetErrorFileHandle (stderr, false);
@@ -1309,12 +1314,6 @@ wmain(int argc, wchar_t const *wargv[])
main(int argc, char const *argv[])
#endif
{
-#ifdef _MSC_VER
- // disable buffering on windows
- setvbuf(stdout, NULL, _IONBF, 0);
- setvbuf(stdin , NULL, _IONBF, 0);
-#endif
-
#ifdef _WIN32
// Convert wide arguments to UTF-8
std::vector<std::string> argvStrings(argc);
OpenPOWER on IntegriCloud