From ebbb8f3a418dd6d4a4559a15726468250b5a2290 Mon Sep 17 00:00:00 2001 From: Hafiz Abid Qadeer Date: Thu, 4 Dec 2014 11:05:31 +0000 Subject: [PATCH] Cleanup of the fix done recently for a lldb-mi hang on OSX. It was observed that we dont need to set stdin to unbuffered and setting console to non-canonical mode. Patch originally came from "Ilia K " llvm-svn: 223353 --- lldb/tools/lldb-mi/MICmnStreamStdinLinux.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/lldb/tools/lldb-mi/MICmnStreamStdinLinux.cpp b/lldb/tools/lldb-mi/MICmnStreamStdinLinux.cpp index 7483853..ef9030b 100644 --- a/lldb/tools/lldb-mi/MICmnStreamStdinLinux.cpp +++ b/lldb/tools/lldb-mi/MICmnStreamStdinLinux.cpp @@ -161,23 +161,14 @@ CMICmnStreamStdinLinux::InputAvailable(bool &vwbAvail) // Although this problem was not observed on Linux. // A solution based on 'select' was also proposed but it seems to slow things down // a lot. - static bool bInitialized = false; - - if (!bInitialized) + int nBytesWaiting; + if (::ioctl(STDIN_FILENO, FIONREAD, &nBytesWaiting) == -1) { - // Use termios to turn off line buffering - ::termios term; - ::tcgetattr(STDIN_FILENO, &term); - term.c_lflag &= ~ICANON; - ::tcsetattr(STDIN_FILENO, TCSANOW, &term); - ::setbuf(stdin, NULL); - bInitialized = true; + vwbAvail = false; + return MIstatus::failure;; } - - int nBytesWaiting; - ::ioctl(STDIN_FILENO, FIONREAD, &nBytesWaiting); vwbAvail = (nBytesWaiting > 0); -#endif +#endif // !defined( _WIN32 ) return MIstatus::success; } -- 2.7.4