From 93938aab49e221dd7e8897bae7a53326ceadcd8b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 24 Apr 2022 20:45:42 +0800 Subject: [PATCH] refactor(tools): disable ctrl+c --- tools/shell/src/shellEngine.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index beb3f2675e..ac2be3c3cf 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -881,6 +881,10 @@ void shellGetGrantInfo() { void shellQueryInterruptHandler(int32_t signum, void *sigInfo, void *context) { tsem_post(&shell.cancelSem); } +void shellSigintHandler(int32_t signum, void *sigInfo, void *context) { + // do nothing +} + void shellCleanup(void *arg) { taosResetTerminalMode(); } void *shellCancelHandler(void *arg) { @@ -892,7 +896,7 @@ void *shellCancelHandler(void *arg) { } taosResetTerminalMode(); - printf("\nReceive ctrl+c or other signal, quit shell.\n"); + printf("\nReceive SIGTERM or other signal, quit shell.\n"); shellWriteHistory(); shellExit(); } @@ -974,10 +978,11 @@ int32_t shellExecute() { taosThreadCreate(&spid, NULL, shellCancelHandler, NULL); taosSetSignal(SIGTERM, shellQueryInterruptHandler); - taosSetSignal(SIGINT, shellQueryInterruptHandler); taosSetSignal(SIGHUP, shellQueryInterruptHandler); taosSetSignal(SIGABRT, shellQueryInterruptHandler); + taosSetSignal(SIGINT, shellSigintHandler); + shellGetGrantInfo(shell.conn); while (1) { -- GitLab