mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 09:22:05 +00:00
Fix error
This commit is contained in:
parent
9de9af54fe
commit
8b84788d08
@ -104,6 +104,7 @@ namespace ErrorCodes
|
|||||||
extern const int CANNOT_SET_SIGNAL_HANDLER;
|
extern const int CANNOT_SET_SIGNAL_HANDLER;
|
||||||
extern const int UNRECOGNIZED_ARGUMENTS;
|
extern const int UNRECOGNIZED_ARGUMENTS;
|
||||||
extern const int LOGICAL_ERROR;
|
extern const int LOGICAL_ERROR;
|
||||||
|
extern const int CANNOT_OPEN_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -656,10 +657,23 @@ void ClientBase::initTtyBuffer()
|
|||||||
|
|
||||||
if (!ec && exists(tty) && is_character_file(tty)
|
if (!ec && exists(tty) && is_character_file(tty)
|
||||||
&& (tty.permissions() & std::filesystem::perms::others_write) != std::filesystem::perms::none)
|
&& (tty.permissions() & std::filesystem::perms::others_write) != std::filesystem::perms::none)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
tty_buf = std::make_unique<WriteBufferFromFile>(tty_file_name, buf_size);
|
tty_buf = std::make_unique<WriteBufferFromFile>(tty_file_name, buf_size);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (stderr_is_a_tty)
|
catch (const Exception & e)
|
||||||
|
{
|
||||||
|
if (e.code() != ErrorCodes::CANNOT_OPEN_FILE)
|
||||||
|
throw;
|
||||||
|
|
||||||
|
/// It is normal if file exists, indicated as writeable but still cannot be opened.
|
||||||
|
/// Fallback to other options.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stderr_is_a_tty)
|
||||||
{
|
{
|
||||||
tty_buf = std::make_unique<WriteBufferFromFileDescriptor>(STDERR_FILENO, buf_size);
|
tty_buf = std::make_unique<WriteBufferFromFileDescriptor>(STDERR_FILENO, buf_size);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user