diff --git a/src/dnode/src/dnodeSystem.c b/src/dnode/src/dnodeSystem.c index 3a50eca9e680b1a372f57ba2ef8673e924470d45..dcbf249a51024c7aa5569a379633804934f3746c 100644 --- a/src/dnode/src/dnodeSystem.c +++ b/src/dnode/src/dnodeSystem.c @@ -145,6 +145,8 @@ int32_t main(int32_t argc, char *argv[]) { syslog(LOG_INFO, "Shut down TDengine service successfully"); dInfo("TDengine is shut down!"); closelog(); + + tsem_post(&exitSem); return EXIT_SUCCESS; } @@ -170,4 +172,5 @@ static void sigintHandler(int32_t signum) { // inform main thread to exit tsem_post(&exitSem); + tsem_wait(&exitSem); } \ No newline at end of file diff --git a/src/os/inc/osSignal.h b/src/os/inc/osSignal.h index 57582a8a280ecbdc0b8a3dbdecacfdd0bce7a3cf..8016c49ba8f06dc3cb23f9a0e910927c244bbb8e 100644 --- a/src/os/inc/osSignal.h +++ b/src/os/inc/osSignal.h @@ -29,7 +29,7 @@ extern "C" { #endif #ifndef SIGHUP - #define SIGHUP 1234 + #define SIGHUP 1230 #endif #ifndef SIGCHLD diff --git a/src/os/src/windows/wSignal.c b/src/os/src/windows/wSignal.c index 8a3c2cfbd4fe38de2431846912f9984310be4117..3988f0c6e101e84ac7a41b0b2e5199a02dcdac18 100644 --- a/src/os/src/windows/wSignal.c +++ b/src/os/src/windows/wSignal.c @@ -16,18 +16,25 @@ #define _DEFAULT_SOURCE #include "os.h" #include +#include void taosSetSignal(int32_t signum, FSignalHandler sigfp) { if (signum == SIGUSR1) return; - signal(signum, sigfp); + + // SIGHUP doesn't exist in windows, we handle it in the way of ctrlhandler + if (signum == SIGHUP) { + SetConsoleCtrlHandler((PHANDLER_ROUTINE)sigfp, TRUE); + } else { + signal(signum, sigfp); + } } void taosIgnSignal(int32_t signum) { - if (signum == SIGUSR1) return; + if (signum == SIGUSR1 || signum == SIGHUP) return; signal(signum, SIG_IGN); } void taosDflSignal(int32_t signum) { - if (signum == SIGUSR1) return; + if (signum == SIGUSR1 || signum == SIGHUP) return; signal(signum, SIG_DFL); } diff --git a/tests/script/sh/deploy.bat b/tests/script/sh/deploy.bat index 0b419b1e9b68df6bc29a94da0a5b3caefb304915..7a81761e5ba7560eae00d3bf2d60cb120b56686d 100644 --- a/tests/script/sh/deploy.bat +++ b/tests/script/sh/deploy.bat @@ -54,7 +54,7 @@ if %NODE% == 6 set NODE=7600 if %NODE% == 7 set NODE=7700 if %NODE% == 8 set NODE=7800 -set "fqdn=" +rem set "fqdn=" for /f "skip=1" %%A in ( 'wmic computersystem get caption' ) do if not defined fqdn set "fqdn=%%A" diff --git a/tests/script/sh/exec.bat b/tests/script/sh/exec.bat index 47b7910210ea9198557dcbe22bf66b3da032914b..9ad6667644685d26c3634c6f35321aa2242b0734 100644 --- a/tests/script/sh/exec.bat +++ b/tests/script/sh/exec.bat @@ -37,5 +37,12 @@ if %EXEC_OPTON% == start ( if %EXEC_OPTON% == stop ( rem echo wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" list INSTANCE - wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" call terminate > NUL 2>&1 + rem wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" call terminate > NUL 2>&1 + + for /f "tokens=1 skip=1" %%A in ( + 'wmic process where "name='taosd.exe'" get processId ' + ) do ( + rem echo taskkill /IM %%A + taskkill /IM %%A > NUL 2>&1 + ) ) diff --git a/tests/script/wtest.bat b/tests/script/wtest.bat index a89c1df67aa62f54756d76e39500788a566c9ac2..0b5cdda52787971c115a96c3674689f4a42504fc 100644 --- a/tests/script/wtest.bat +++ b/tests/script/wtest.bat @@ -33,7 +33,7 @@ if exist %LOG_DIR% rmdir /s/q %LOG_DIR% if not exist %CFG_DIR% mkdir %CFG_DIR% if not exist %LOG_DIR% mkdir %LOG_DIR% -set "fqdn=" +rem set "fqdn=" for /f "skip=1" %%A in ( 'wmic computersystem get caption' ) do if not defined fqdn set "fqdn=%%A"