forked from OSchip/llvm-project
Don't disable stdin buffering on Windows
Disabling buffering exposes a bug in the MS VS 2015 CRT implementation of fgets, where you sometimes have to hit Enter twice, depending on if the input had an odd or even number of characters. This was hidden until a few days ago by the Python initialization which was re-enabling buffering on the streams. A few days ago, Enrico make the Python initialization on-demand, which exposed this problem. llvm-svn: 266384
This commit is contained in:
parent
1dd2752e7a
commit
f6034c4f3d
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue