mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Update ReplxxLineReader.cpp
This commit is contained in:
parent
d0312bf1fe
commit
7003fe8258
@ -26,26 +26,28 @@ ReplxxLineReader::ReplxxLineReader(
|
||||
|
||||
if (!history_file_path.empty())
|
||||
{
|
||||
errno = 0;
|
||||
history_file_fd = open(history_file_path.c_str(), O_RDWR);
|
||||
if (history_file_fd < 0)
|
||||
{
|
||||
rx.print("Open of history file failed: %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
else
|
||||
{
|
||||
if (flock(history_file_fd, LOCK_SH))
|
||||
{
|
||||
rx.print("Shared lock of history file failed: %s\n", strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
rx.history_load(history_file_path);
|
||||
|
||||
errno = 0;
|
||||
if (flock(history_file_fd, LOCK_UN))
|
||||
{
|
||||
rx.print("Unlock of history file failed: %s\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto callback = [&suggest] (const String & context, size_t context_size)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user