Set cli_quitting to true in cli::cancel()
This commit is contained in:
parent
67e5a06035
commit
2056a35b44
1 changed files with 24 additions and 23 deletions
|
|
@ -54,29 +54,6 @@ void cli::send_notice( uint64_t callback_id, variants args /* = variants() */ )
|
||||||
FC_ASSERT(false);
|
FC_ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cli::stop()
|
|
||||||
{
|
|
||||||
cancel();
|
|
||||||
_run_complete.wait();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cli::cancel()
|
|
||||||
{
|
|
||||||
_run_complete.cancel();
|
|
||||||
#ifdef HAVE_EDITLINE
|
|
||||||
if( _getline_thread )
|
|
||||||
{
|
|
||||||
_getline_thread->signal(SIGINT);
|
|
||||||
_getline_thread = nullptr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void cli::wait()
|
|
||||||
{
|
|
||||||
_run_complete.wait();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cli::format_result( const string& method, std::function<string(variant,const variants&)> formatter)
|
void cli::format_result( const string& method, std::function<string(variant,const variants&)> formatter)
|
||||||
{
|
{
|
||||||
_result_formatters[method] = formatter;
|
_result_formatters[method] = formatter;
|
||||||
|
|
@ -292,6 +269,30 @@ void cli::start()
|
||||||
_run_complete = fc::async( [this](){ run(); } );
|
_run_complete = fc::async( [this](){ run(); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cli::cancel()
|
||||||
|
{
|
||||||
|
_run_complete.cancel();
|
||||||
|
#ifdef HAVE_EDITLINE
|
||||||
|
cli_quitting = true;
|
||||||
|
if( _getline_thread )
|
||||||
|
{
|
||||||
|
_getline_thread->signal(SIGINT);
|
||||||
|
_getline_thread = nullptr;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cli::stop()
|
||||||
|
{
|
||||||
|
cancel();
|
||||||
|
_run_complete.wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cli::wait()
|
||||||
|
{
|
||||||
|
_run_complete.wait();
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* @brief Read input from the user
|
* @brief Read input from the user
|
||||||
* @param prompt the prompt to display
|
* @param prompt the prompt to display
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue