This commit is contained in:
kssenii 2021-09-30 06:35:35 +00:00
parent 59cbe8579d
commit 410b17b4a1
2 changed files with 11 additions and 6 deletions

View File

@ -413,13 +413,18 @@ int LocalServer::main(const std::vector<std::string> & /*args*/)
try try
{ {
UseSSL use_ssl; UseSSL use_ssl;
InterruptListener interrupt_listener;
ThreadStatus thread_status; ThreadStatus thread_status;
std::cout << std::fixed << std::setprecision(3); std::cout << std::fixed << std::setprecision(3);
std::cerr << std::fixed << std::setprecision(3); std::cerr << std::fixed << std::setprecision(3);
if (!is_interactive) is_interactive = stdin_is_a_tty && !config().has("query") && !config().has("table-structure") && queries_files.empty();
std::optional<InterruptListener> interrupt_listener;
if (is_interactive)
{
interrupt_listener.emplace();
}
else
{ {
/// We will terminate process on error /// We will terminate process on error
static KillingErrorHandler error_handler; static KillingErrorHandler error_handler;
@ -437,7 +442,6 @@ try
processConfig(); processConfig();
applyCmdSettings(global_context); applyCmdSettings(global_context);
connect(); connect();
if (is_interactive) if (is_interactive)
@ -478,13 +482,11 @@ catch (...)
void LocalServer::processConfig() void LocalServer::processConfig()
{ {
if (stdin_is_a_tty && !config().has("query") && !config().has("table-structure") && queries_files.empty()) if (is_interactive)
{ {
if (config().has("query") && config().has("queries-file")) if (config().has("query") && config().has("queries-file"))
throw Exception("Specify either `query` or `queries-file` option", ErrorCodes::BAD_ARGUMENTS); throw Exception("Specify either `query` or `queries-file` option", ErrorCodes::BAD_ARGUMENTS);
is_interactive = true;
if (config().has("multiquery")) if (config().has("multiquery"))
is_multiquery = true; is_multiquery = true;

View File

@ -212,6 +212,9 @@ std_cerr_cout_excludes=(
src/Interpreters/Context.cpp src/Interpreters/Context.cpp
# IProcessor::dump() # IProcessor::dump()
src/Processors/IProcessor.cpp src/Processors/IProcessor.cpp
src/Client/ClientBase.cpp
src/Client/QueryFuzzer.cpp
src/Client/Suggest.cpp
) )
sources_with_std_cerr_cout=( $( sources_with_std_cerr_cout=( $(
find $ROOT_PATH/src -name '*.h' -or -name '*.cpp' | \ find $ROOT_PATH/src -name '*.h' -or -name '*.cpp' | \