From a3056e8cdfe745311801b5c14ec8ed5ad36798cb Mon Sep 17 00:00:00 2001 From: Codex Date: Fri, 10 Jul 2026 13:19:31 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AF=86=E5=88=AB=20Windows=20Python=20?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E8=8A=82=E7=82=B9=E8=BF=9B=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 忽略 pyw 启动器,只按 python 解释器统计节点实例,避免误报重复进程。 Co-Authored-By: Claude Opus 4.7 --- scripts/src/hwlab-hwpod-node.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/src/hwlab-hwpod-node.ts b/scripts/src/hwlab-hwpod-node.ts index a4770959..e2303b3c 100644 --- a/scripts/src/hwlab-hwpod-node.ts +++ b/scripts/src/hwlab-hwpod-node.ts @@ -526,7 +526,7 @@ $probe = [string]$payload.probeLauncherPath $launcherArgs = @($payload.launcherArgs | ForEach-Object { [string]$_ }) $versionOut = @(& $probe @launcherArgs -c "import sys;print(sys.version);print(sys.executable)" 2>&1) $versionExit = $LASTEXITCODE -$processes = @(Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -and $_.CommandLine.Contains($scriptPath) }) +$processes = @(Get-CimInstance Win32_Process | Where-Object { $_.Name -like 'python*.exe' -and $_.CommandLine -and $_.CommandLine.Contains($scriptPath) }) $explorerSessions = @(Get-Process explorer -ErrorAction SilentlyContinue | Select-Object -ExpandProperty SessionId -Unique) $interactive = @($processes | Where-Object { $explorerSessions -contains $_.SessionId }) $runValue = (Get-ItemProperty -Path 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run' -Name ([string]$payload.runKeyName) -ErrorAction SilentlyContinue).([string]$payload.runKeyName) @@ -594,7 +594,7 @@ $stdoutPath = $logPath + '.stdout' $stderrPath = $logPath + '.stderr' Start-Process -FilePath $gui -ArgumentList @($launcherArgs + @($scriptPath)) -WorkingDirectory $root -RedirectStandardOutput $stdoutPath -RedirectStandardError $stderrPath Start-Sleep -Seconds 3 -$processes = @(Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -and $_.CommandLine.Contains($scriptPath) }) +$processes = @(Get-CimInstance Win32_Process | Where-Object { $_.Name -like 'python*.exe' -and $_.CommandLine -and $_.CommandLine.Contains($scriptPath) }) $explorerSessions = @(Get-Process explorer -ErrorAction SilentlyContinue | Select-Object -ExpandProperty SessionId -Unique) $interactive = @($processes | Where-Object { $explorerSessions -contains $_.SessionId }) $result = [ordered]@{