refactor(tools): disable ctrl+c

This commit is contained in:
Shengliang Guan 2022-04-24 20:45:42 +08:00
parent 780561bc9b
commit 93938aab49
1 changed files with 7 additions and 2 deletions

View File

@ -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) {