construct: Fix combinations of -execute and -console ignoring the latter.

This commit is contained in:
Jason Volk 2022-05-01 19:38:06 -07:00
parent 0fbbf1853f
commit 8e1c80e6ac
3 changed files with 10 additions and 2 deletions

View File

@ -74,6 +74,9 @@ construct::console::queue;
decltype(construct::console::quit_when_done)
construct::console::quit_when_done;
decltype(construct::console::interactive_when_done)
construct::console::interactive_when_done;
bool
construct::console::spawn()
{
@ -195,10 +198,13 @@ construct::console::handle_queued()
if(!next_command())
break;
if(!quit_when_done)
if(run::level != run::level::RUN)
return true;
if(run::level != run::level::RUN)
if(interactive_when_done)
return false;
if(!quit_when_done)
return true;
static ircd::ios::descriptor descriptor

View File

@ -20,6 +20,7 @@ struct construct::console
static std::once_flag seen_message;
static std::deque<std::string> queue;
static bool quit_when_done;
static bool interactive_when_done;
std::string line;
std::string record_path;

View File

@ -243,6 +243,7 @@ noexcept try
// without having to send a ctrl-c for it, that is provided here. This does
// not actually take effect until it's processed in the ios.run() below.
if(cmdline || !execute.empty())
construct::console::interactive_when_done = cmdline,
construct::console::spawn();
// If the user wants to immediately process console commands