mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-14448: Ctrl-C should not exit the client
This commit is contained in:
@@ -1368,12 +1368,21 @@ sig_handler handle_sigint(int sig)
|
|||||||
char kill_buffer[40];
|
char kill_buffer[40];
|
||||||
MYSQL *kill_mysql= NULL;
|
MYSQL *kill_mysql= NULL;
|
||||||
|
|
||||||
/* terminate if no query being executed, or we already tried interrupting */
|
/* Terminate if we already tried interrupting. */
|
||||||
if (!executing_query || (interrupted_query == 2))
|
if (interrupted_query == 2)
|
||||||
{
|
{
|
||||||
tee_fprintf(stdout, "Ctrl-C -- exit!\n");
|
tee_fprintf(stdout, "Ctrl-C -- exit!\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
/* If no query being executed, don't exit. */
|
||||||
|
if (!executing_query)
|
||||||
|
{
|
||||||
|
tee_fprintf(stdout, "Ctrl-C\n");
|
||||||
|
rl_on_new_line(); // Regenerate the prompt on a newline
|
||||||
|
rl_replace_line("", 0); // Clear the previous text
|
||||||
|
rl_redisplay();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
kill_mysql= mysql_init(kill_mysql);
|
kill_mysql= mysql_init(kill_mysql);
|
||||||
if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
|
if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
|
||||||
|
Reference in New Issue
Block a user