diff options
Diffstat (limited to 'contrib/epee/include/console_handler.h')
-rw-r--r-- | contrib/epee/include/console_handler.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/contrib/epee/include/console_handler.h b/contrib/epee/include/console_handler.h index 95b986ff5..54e3e966d 100644 --- a/contrib/epee/include/console_handler.h +++ b/contrib/epee/include/console_handler.h @@ -133,7 +133,7 @@ namespace epee bool wait_stdin_data() { #if !defined(WIN32) - #ifdef __OpenBSD__ + #if defined(__OpenBSD__) || defined(__ANDROID__) int stdin_fileno = fileno(stdin); #else int stdin_fileno = ::fileno(stdin); @@ -155,6 +155,20 @@ namespace epee else if (0 < retval) return true; } +#else + while (m_run.load(std::memory_order_relaxed)) + { + int retval = ::WaitForSingleObject(::GetStdHandle(STD_INPUT_HANDLE), 100); + switch (retval) + { + case WAIT_FAILED: + return false; + case WAIT_OBJECT_0: + return true; + default: + break; + } + } #endif return true; @@ -263,11 +277,11 @@ namespace epee { if (!m_prompt.empty()) { - epee::log_space::set_console_color(epee::log_space::console_color_yellow, true); + epee::set_console_color(epee::console_color_yellow, true); std::cout << m_prompt; if (' ' != m_prompt.back()) std::cout << ' '; - epee::log_space::reset_console_color(); + epee::reset_console_color(); std::cout.flush(); } } @@ -296,7 +310,7 @@ namespace epee } if (!get_line_ret) { - LOG_PRINT("Failed to read line.", LOG_LEVEL_0); + MERROR("Failed to read line."); } string_tools::trim(command); |