0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-29 08:54:02 +01:00

construct: Improve console interrupt related.

This commit is contained in:
Jason Volk 2018-04-06 23:35:25 -07:00
parent 58af1ae88c
commit e5d8d6ae67
3 changed files with 10 additions and 3 deletions

View file

@ -345,7 +345,10 @@ void
check_console_active() check_console_active()
{ {
if(console_active) if(console_active)
throw ircd::error("Console is already active and cannot be reentered"); throw ircd::error
{
"Console is already active and cannot be reentered"
};
} }
void void

View file

@ -334,8 +334,11 @@ bool
handle_interruption() handle_interruption()
try try
{ {
if(console_active)
console_cancel(); console_cancel();
else
console_spawn(); console_spawn();
return true; return true;
} }
catch(const std::exception &e) catch(const std::exception &e)

View file

@ -18,6 +18,7 @@ extern std::unique_ptr<boost::asio::io_service> ios;
// console.cc // console.cc
// //
extern bool console_active;
void console_spawn(); void console_spawn();
void console_execute(const std::vector<std::string> &lines); void console_execute(const std::vector<std::string> &lines);
void console_cancel(); void console_cancel();