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 <ki.stfu@gmail.com>"

llvm-svn: 223353
This commit is contained in:
Hafiz Abid Qadeer 2014-12-04 11:05:31 +00:00
parent 117da44729
commit ebbb8f3a41
1 changed files with 6 additions and 15 deletions

View File

@ -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)
{
// 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;
}
int nBytesWaiting;
::ioctl(STDIN_FILENO, FIONREAD, &nBytesWaiting);
if (::ioctl(STDIN_FILENO, FIONREAD, &nBytesWaiting) == -1)
{
vwbAvail = false;
return MIstatus::failure;;
}
vwbAvail = (nBytesWaiting > 0);
#endif
#endif // !defined( _WIN32 )
return MIstatus::success;
}