From acb53934ead7616b31bc7c2261ff9ad4d3bed150 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Thu, 7 May 2026 16:03:47 +0800 Subject: [PATCH 1/2] Add Windows pre-cleanup to CI workflows --- .github/workflows/new-framework-test.yml | 16 ++++++++++++++++ .github/workflows/run-tests-on-windows.yml | 17 ++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.github/workflows/new-framework-test.yml b/.github/workflows/new-framework-test.yml index 6057553..3cac0ab 100644 --- a/.github/workflows/new-framework-test.yml +++ b/.github/workflows/new-framework-test.yml @@ -112,6 +112,22 @@ jobs: ref: "main" fetch-depth: 0 + - name: init environment + if: always() && matrix.platform == 'windows' + shell: cmd + continue-on-error: true + run: | + :: 前置清理:杀掉上次残留的进程,避免 DLL/日志文件被占用 + taskkill /F ^ + /IM "python.exe" ^ + /IM "python3.exe" ^ + /IM "taosd.exe" ^ + /IM "tmq_sim.exe" ^ + /IM "taosdump.exe" ^ + /IM "taosBenchmark.exe" ^ + >nul 2>&1 + if %errorlevel% EQU 0 (echo Processes terminated) else (echo No processes found) + - name: Debug env run: | echo "platform=${{ matrix.platform }}" diff --git a/.github/workflows/run-tests-on-windows.yml b/.github/workflows/run-tests-on-windows.yml index 47a7ffe..563763a 100644 --- a/.github/workflows/run-tests-on-windows.yml +++ b/.github/workflows/run-tests-on-windows.yml @@ -55,13 +55,16 @@ jobs: continue-on-error: true if: always() run: | - tasklist /FI "IMAGENAME eq python3.exe" /NH | findstr /I python3.exe >nul - if %errorlevel% equ 0 ( - wmic process where "name='python3.exe'" delete - echo Python3 process has been terminated. - ) else ( - echo No Python3 process was found. - ) + :: 前置清理:杀掉上次残留的进程,避免 DLL/日志文件被占用 + taskkill /F ^ + /IM "python.exe" ^ + /IM "python3.exe" ^ + /IM "taosd.exe" ^ + /IM "tmq_sim.exe" ^ + /IM "taosdump.exe" ^ + /IM "taosBenchmark.exe" ^ + >nul 2>&1 + if %errorlevel% EQU 0 (echo Processes terminated) else (echo No processes found) - name: Set environment variables based on condition run: | From eb1a77479c2e55a927d3ed237c4e8ec0b72eb206 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Thu, 7 May 2026 20:28:39 +0800 Subject: [PATCH 2/2] Fix Windows cleanup taskkill handling Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/new-framework-test.yml | 15 +++++------ .github/workflows/run-tests-on-windows.yml | 30 +++++++++------------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/.github/workflows/new-framework-test.yml b/.github/workflows/new-framework-test.yml index 3cac0ab..4cd6a4c 100644 --- a/.github/workflows/new-framework-test.yml +++ b/.github/workflows/new-framework-test.yml @@ -118,15 +118,12 @@ jobs: continue-on-error: true run: | :: 前置清理:杀掉上次残留的进程,避免 DLL/日志文件被占用 - taskkill /F ^ - /IM "python.exe" ^ - /IM "python3.exe" ^ - /IM "taosd.exe" ^ - /IM "tmq_sim.exe" ^ - /IM "taosdump.exe" ^ - /IM "taosBenchmark.exe" ^ - >nul 2>&1 - if %errorlevel% EQU 0 (echo Processes terminated) else (echo No processes found) + set "FOUND_PROCESS=0" + for %%I in (python.exe python3.exe taosd.exe tmq_sim.exe taosdump.exe taosBenchmark.exe) do ( + taskkill /F /T /IM "%%~I" >nul 2>&1 + if not errorlevel 1 set "FOUND_PROCESS=1" + ) + if "%FOUND_PROCESS%"=="1" (echo Processes terminated) else (echo No processes found) - name: Debug env run: | diff --git a/.github/workflows/run-tests-on-windows.yml b/.github/workflows/run-tests-on-windows.yml index 563763a..815ee69 100644 --- a/.github/workflows/run-tests-on-windows.yml +++ b/.github/workflows/run-tests-on-windows.yml @@ -56,15 +56,12 @@ jobs: if: always() run: | :: 前置清理:杀掉上次残留的进程,避免 DLL/日志文件被占用 - taskkill /F ^ - /IM "python.exe" ^ - /IM "python3.exe" ^ - /IM "taosd.exe" ^ - /IM "tmq_sim.exe" ^ - /IM "taosdump.exe" ^ - /IM "taosBenchmark.exe" ^ - >nul 2>&1 - if %errorlevel% EQU 0 (echo Processes terminated) else (echo No processes found) + set "FOUND_PROCESS=0" + for %%I in (python.exe python3.exe taosd.exe tmq_sim.exe taosdump.exe taosBenchmark.exe) do ( + taskkill /F /T /IM "%%~I" >nul 2>&1 + if not errorlevel 1 set "FOUND_PROCESS=1" + ) + if "%FOUND_PROCESS%"=="1" (echo Processes terminated) else (echo No processes found) - name: Set environment variables based on condition run: | @@ -251,13 +248,10 @@ jobs: continue-on-error: true if: always() run: | - taskkill /F ^ - /IM "python.exe" ^ - /IM "python3.exe" ^ - /IM "taosd.exe" ^ - /IM "tmq_sim.exe" ^ - /IM "taosdump.exe" ^ - /IM "taosBenchmark.exe" ^ - >nul 2>&1 - if %errorlevel% EQU 0 (echo Processes terminated) else (echo No processes found) + set "FOUND_PROCESS=0" + for %%I in (python.exe python3.exe taosd.exe tmq_sim.exe taosdump.exe taosBenchmark.exe) do ( + taskkill /F /T /IM "%%~I" >nul 2>&1 + if not errorlevel 1 set "FOUND_PROCESS=1" + ) + if "%FOUND_PROCESS%"=="1" (echo Processes terminated) else (echo No processes found) exit /b 0