Skip to content

Commit

Permalink
Addition to prev. revision #2877
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-milovidov committed Aug 20, 2018
1 parent b98cfe0 commit d278cbb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dbms/programs/client/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ namespace ErrorCodes
extern const int CLIENT_OUTPUT_FORMAT_SPECIFIED;
extern const int LOGICAL_ERROR;
extern const int CANNOT_SET_SIGNAL_HANDLER;
extern const int CANNOT_READLINE;
}


Expand Down Expand Up @@ -1518,6 +1519,9 @@ class Client : public Poco::Util::Application
}

#if USE_READLINE
if (rl_initialize())
throw Exception("Cannot initialize readline", ErrorCodes::CANNOT_READLINE);

auto clear_prompt_or_exit = [](int)
{
/// This is signal safe.
Expand All @@ -1526,7 +1530,8 @@ class Client : public Poco::Util::Application
if (res == 1 && rl_line_buffer[0])
{
rl_replace_line("", 0);
rl_forced_update_display();
if (rl_forced_update_display())
_exit(0);
}
else
{
Expand Down
1 change: 1 addition & 0 deletions dbms/src/Common/ErrorCodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ namespace ErrorCodes
extern const int PTHREAD_ERROR = 411;
extern const int NETLINK_ERROR = 412;
extern const int CANNOT_SET_SIGNAL_HANDLER = 413;
extern const int CANNOT_READLINE = 414;

extern const int KEEPER_EXCEPTION = 999;
extern const int POCO_EXCEPTION = 1000;
Expand Down

0 comments on commit d278cbb

Please sign in to comment.