refactor(tools): disable ctrl+c
This commit is contained in:
parent
780561bc9b
commit
93938aab49
|
@ -881,6 +881,10 @@ void shellGetGrantInfo() {
|
||||||
|
|
||||||
void shellQueryInterruptHandler(int32_t signum, void *sigInfo, void *context) { tsem_post(&shell.cancelSem); }
|
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 shellCleanup(void *arg) { taosResetTerminalMode(); }
|
||||||
|
|
||||||
void *shellCancelHandler(void *arg) {
|
void *shellCancelHandler(void *arg) {
|
||||||
|
@ -892,7 +896,7 @@ void *shellCancelHandler(void *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
taosResetTerminalMode();
|
taosResetTerminalMode();
|
||||||
printf("\nReceive ctrl+c or other signal, quit shell.\n");
|
printf("\nReceive SIGTERM or other signal, quit shell.\n");
|
||||||
shellWriteHistory();
|
shellWriteHistory();
|
||||||
shellExit();
|
shellExit();
|
||||||
}
|
}
|
||||||
|
@ -974,10 +978,11 @@ int32_t shellExecute() {
|
||||||
taosThreadCreate(&spid, NULL, shellCancelHandler, NULL);
|
taosThreadCreate(&spid, NULL, shellCancelHandler, NULL);
|
||||||
|
|
||||||
taosSetSignal(SIGTERM, shellQueryInterruptHandler);
|
taosSetSignal(SIGTERM, shellQueryInterruptHandler);
|
||||||
taosSetSignal(SIGINT, shellQueryInterruptHandler);
|
|
||||||
taosSetSignal(SIGHUP, shellQueryInterruptHandler);
|
taosSetSignal(SIGHUP, shellQueryInterruptHandler);
|
||||||
taosSetSignal(SIGABRT, shellQueryInterruptHandler);
|
taosSetSignal(SIGABRT, shellQueryInterruptHandler);
|
||||||
|
|
||||||
|
taosSetSignal(SIGINT, shellSigintHandler);
|
||||||
|
|
||||||
shellGetGrantInfo(shell.conn);
|
shellGetGrantInfo(shell.conn);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
Loading…
Reference in New Issue