mirror of
https://github.com/monero-project/monero.git
synced 2024-11-17 08:17:37 +00:00
Merge pull request #37 from tewinget/signals_fix
Fixed console handler not properly exiting on SIGINT and such
This commit is contained in:
commit
94cc5a7d71
1 changed files with 7 additions and 1 deletions
|
@ -233,6 +233,7 @@ namespace epee
|
||||||
|
|
||||||
void stop()
|
void stop()
|
||||||
{
|
{
|
||||||
|
m_running = false;
|
||||||
m_stdin_reader.stop();
|
m_stdin_reader.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,6 +245,10 @@ namespace epee
|
||||||
bool continue_handle = true;
|
bool continue_handle = true;
|
||||||
while(continue_handle)
|
while(continue_handle)
|
||||||
{
|
{
|
||||||
|
if (!m_running)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!prompt.empty())
|
if (!prompt.empty())
|
||||||
{
|
{
|
||||||
epee::log_space::set_console_color(epee::log_space::console_color_yellow, true);
|
epee::log_space::set_console_color(epee::log_space::console_color_yellow, true);
|
||||||
|
@ -257,7 +262,7 @@ namespace epee
|
||||||
std::string command;
|
std::string command;
|
||||||
if(!m_stdin_reader.get_line(command))
|
if(!m_stdin_reader.get_line(command))
|
||||||
{
|
{
|
||||||
LOG_PRINT("Failed to read line. Ignoring and continuing to run, exiting daemon may require a SIGTERM kill.", LOG_LEVEL_0);
|
LOG_PRINT("Failed to read line.", LOG_LEVEL_0);
|
||||||
}
|
}
|
||||||
string_tools::trim(command);
|
string_tools::trim(command);
|
||||||
|
|
||||||
|
@ -285,6 +290,7 @@ namespace epee
|
||||||
|
|
||||||
private:
|
private:
|
||||||
async_stdin_reader m_stdin_reader;
|
async_stdin_reader m_stdin_reader;
|
||||||
|
bool m_running = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue