diff --git a/construct/console.cc b/construct/console.cc index ec01a2bd1..6e6436df1 100644 --- a/construct/console.cc +++ b/construct/console.cc @@ -84,6 +84,9 @@ construct::console::quit_when_done; decltype(construct::console::interactive_when_done) construct::console::interactive_when_done; +decltype(construct::console::silent) +construct::console::silent; + bool construct::console::spawn() { @@ -359,7 +362,12 @@ construct::console::handle_line_bymodule() pbase(), pptr() }; + setp(pbase(), epptr()); record_append(str); + + if(silent) + return 0; + std::cout << str; wrote += size(str); if(wrote >= size_t(ratelimit_bytes)) @@ -369,7 +377,6 @@ construct::console::handle_line_bymodule() wrote = 0; } - setp(pbase(), epptr()); return 0; } @@ -412,7 +419,7 @@ construct::console::handle_line_bymodule() view(out, outbuf) }; - if(!endswith(str, '\n')) + if(!endswith(str, '\n') && !silent) std::cout << std::endl; return ret; diff --git a/construct/console.h b/construct/console.h index 170752563..127283c73 100644 --- a/construct/console.h +++ b/construct/console.h @@ -22,6 +22,7 @@ struct construct::console static std::deque queue; static bool quit_when_done; static bool interactive_when_done; + static bool silent; std::string line; std::string record_path; diff --git a/construct/construct.cc b/construct/construct.cc index 9b23cffd4..43275d081 100644 --- a/construct/construct.cc +++ b/construct/construct.cc @@ -49,6 +49,7 @@ bool defaults; const char *bootstrap; const char *diagnostic; bool nobanner; +bool silentmode; lgetopt opts[] { @@ -85,6 +86,7 @@ lgetopt opts[] { "bootstrap", &bootstrap, lgetopt::STRING, "Bootstrap fresh database from event vector" }, { "diagnostic", &diagnostic, lgetopt::STRING, "Specify a diagnostic type in conjunction with other commands" }, { "nobanner", &nobanner, lgetopt::BOOL, "Terminal log enabled only in runlevel RUN" }, + { "silent", &silentmode, lgetopt::BOOL, "Like quiet mode without console output either" }, { nullptr, nullptr, lgetopt::STRING, nullptr }, }; @@ -629,8 +631,11 @@ applyargs() if(soft_assert) ircd::soft_assert.set("true"); - if(quietmode || nobanner) + if(quietmode || nobanner || silentmode) ircd::log::console_disable(); + + if(silentmode) + construct::console::silent = true; } ///////////////////////////////////////////////////////////////////////////////