0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 08:42:34 +01:00

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) decltype(construct::console::quit_when_done)
construct::console::quit_when_done; construct::console::quit_when_done;
decltype(construct::console::interactive_when_done)
construct::console::interactive_when_done;
bool bool
construct::console::spawn() construct::console::spawn()
{ {
@ -195,10 +198,13 @@ construct::console::handle_queued()
if(!next_command()) if(!next_command())
break; break;
if(!quit_when_done) if(run::level != run::level::RUN)
return true; return true;
if(run::level != run::level::RUN) if(interactive_when_done)
return false;
if(!quit_when_done)
return true; return true;
static ircd::ios::descriptor descriptor static ircd::ios::descriptor descriptor

View file

@ -20,6 +20,7 @@ struct construct::console
static std::once_flag seen_message; static std::once_flag seen_message;
static std::deque<std::string> queue; static std::deque<std::string> queue;
static bool quit_when_done; static bool quit_when_done;
static bool interactive_when_done;
std::string line; std::string line;
std::string record_path; 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 // 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. // not actually take effect until it's processed in the ios.run() below.
if(cmdline || !execute.empty()) if(cmdline || !execute.empty())
construct::console::interactive_when_done = cmdline,
construct::console::spawn(); construct::console::spawn();
// If the user wants to immediately process console commands // If the user wants to immediately process console commands