Fixed assert when try read unavailable stdin.

bug-68
XMRig 2017-08-05 18:45:06 +03:00
parent 1720d3e096
commit 62681adcfb
1 changed files with 5 additions and 1 deletions

View File

@ -31,8 +31,12 @@ Console::Console(IConsoleListener *listener)
{
m_tty.data = this;
uv_tty_init(uv_default_loop(), &m_tty, 0, 1);
uv_tty_set_mode(&m_tty, UV_TTY_MODE_RAW);
if (!uv_is_readable(reinterpret_cast<uv_stream_t*>(&m_tty))) {
return;
}
uv_tty_set_mode(&m_tty, UV_TTY_MODE_RAW);
uv_read_start(reinterpret_cast<uv_stream_t*>(&m_tty), Console::onAllocBuffer, Console::onRead);
}