From d192e3c434b20ede868740c726a2daf3cfe1b508 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Sat, 12 Sep 2026 19:04:00 +0200 Subject: [PATCH] fix: stderr nativo via cmd /c por NativeCommandError en PS 5.1 (issue 4002) --- hermes/deploy.ps1 | 11 +++++++---- openclaw/deploy.ps1 | 11 +++++++---- openwebui/deploy.ps1 | 14 ++++++++++---- wordpress/deploy.ps1 | 14 ++++++++++---- 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/hermes/deploy.ps1 b/hermes/deploy.ps1 index cffe780..260e145 100644 --- a/hermes/deploy.ps1 +++ b/hermes/deploy.ps1 @@ -63,7 +63,9 @@ if (-not (Get-Command docker -ErrorAction SilentlyContinue)) { Write-Host ' https://docs.docker.com/desktop/setup/install/windows-install/' exit 1 } -try { docker info *> $null } catch { +# En PS 5.1, *> $null sobre comandos nativos convierte stderr en errores +# terminantes con EAP=Stop (PS #4002). Se descarta via cmd /c. +if (-not (cmd /c "docker info >NUL 2>&1")) { Err 'Docker Desktop no responde. Abre Docker Desktop y espera a que arranque.' exit 1 } @@ -107,7 +109,8 @@ if (-not $running) { Warn ' Esperando a que Ollama arranque...' $MaxWait = 60; $Waited = 0 while ($true) { - docker exec d0a1-hermes-ollama ollama ps *> $null + # Descarte de stderr via cmd /c (ver nota de PS 5.1 / PS #4002 arriba) + cmd /c "docker exec d0a1-hermes-ollama ollama ps >NUL 2>&1" if ($LASTEXITCODE -eq 0) { break } Start-Sleep -Seconds 2 $Waited += 2 @@ -124,7 +127,7 @@ Ok "Ollama corriendo en http://localhost:${OllamaPort}" # --- 2. Instalar Hermes Agent ------------------------------------------------ Warn '[2/3] Instalando Hermes Agent...' if (Get-Command hermes -ErrorAction SilentlyContinue) { - Ok "Hermes Agent ya instalado: $(hermes --version 2>$null)" + Ok "Hermes Agent ya instalado: $(cmd /c 'hermes --version 2>NUL')" } else { # En Windows: instala con winget o pip. El install.sh de Linux no aplica. Write-Host ' Instalando con pip (requiere Python 3.10+)...' @@ -134,7 +137,7 @@ if (Get-Command hermes -ErrorAction SilentlyContinue) { Write-Host ' https://hermes-agent.nousresearch.com/docs' exit 1 } - Ok "Hermes Agent instalado: $(hermes --version 2>$null)" + Ok "Hermes Agent instalado: $(cmd /c 'hermes --version 2>NUL')" } # --- 3. Configurar ------------------------------------------------------------ diff --git a/openclaw/deploy.ps1 b/openclaw/deploy.ps1 index 809efe0..86c00d0 100644 --- a/openclaw/deploy.ps1 +++ b/openclaw/deploy.ps1 @@ -63,7 +63,9 @@ if (-not (Get-Command docker -ErrorAction SilentlyContinue)) { Write-Host ' https://docs.docker.com/desktop/setup/install/windows-install/' exit 1 } -try { docker info *> $null } catch { +# En PS 5.1, *> $null sobre comandos nativos convierte stderr en errores +# terminantes con EAP=Stop (PS #4002). Se descarta via cmd /c. +if (-not (cmd /c "docker info >NUL 2>&1")) { Err 'Docker Desktop no responde. Abre Docker Desktop y espera a que arranque.' exit 1 } @@ -107,7 +109,8 @@ if (-not $running) { Warn ' Esperando a que Ollama arranque...' $MaxWait = 60; $Waited = 0 while ($true) { - docker exec d0a1-openclaw-ollama ollama ps *> $null + # Descarte de stderr via cmd /c (ver nota de PS 5.1 / PS #4002 arriba) + cmd /c "docker exec d0a1-openclaw-ollama ollama ps >NUL 2>&1" if ($LASTEXITCODE -eq 0) { break } Start-Sleep -Seconds 2 $Waited += 2 @@ -124,7 +127,7 @@ Ok "Ollama corriendo en http://localhost:${OllamaPort}" # --- 2. Instalar OpenClaw ----------------------------------------------------- Warn '[2/3] Instalando OpenClaw...' if (Get-Command openclaw -ErrorAction SilentlyContinue) { - Ok "OpenClaw ya instalado: $(openclaw --version 2>$null)" + Ok "OpenClaw ya instalado: $(cmd /c 'openclaw --version 2>NUL')" } else { # En Windows: instala con npm (Node 18+). El install.sh de Linux no aplica. Write-Host ' Instalando con npm (requiere Node.js 18+)...' @@ -134,7 +137,7 @@ if (Get-Command openclaw -ErrorAction SilentlyContinue) { Write-Host ' https://openclaw.ai/docs' exit 1 } - Ok "OpenClaw instalado: $(openclaw --version 2>$null)" + Ok "OpenClaw instalado: $(cmd /c 'openclaw --version 2>NUL')" } # --- 3. Configurar ------------------------------------------------------------ diff --git a/openwebui/deploy.ps1 b/openwebui/deploy.ps1 index 0e9854f..b1a725a 100644 --- a/openwebui/deploy.ps1 +++ b/openwebui/deploy.ps1 @@ -61,16 +61,21 @@ if (-not (Get-Command docker -ErrorAction SilentlyContinue)) { Write-Host ' https://docs.docker.com/desktop/setup/install/windows-install/' exit 1 } -try { docker info *> $null } catch { +# En PS 5.1, *> $null sobre comandos nativos convierte stderr en errores +# terminantes con EAP=Stop (PS #4002). Se descarta via cmd /c. +if (-not (cmd /c "docker info >NUL 2>&1")) { Err 'Docker Desktop no responde. Abre Docker Desktop y espera a que arranque.' exit 1 } -try { docker compose version *> $null; $composeOk = $true } catch { $composeOk = $false } +# En PS 5.1, *> $null sobre comandos nativos convierte stderr en errores +# terminantes con EAP=Stop (PS #4002). Se descarta via cmd /c. +cmd /c "docker compose version >NUL 2>&1" +$composeOk = ($LASTEXITCODE -eq 0) if (-not $composeOk) { Err 'Docker Compose v2 no disponible. Actualiza Docker Desktop.' exit 1 } -Ok "Docker: $(docker compose version --short 2>$null)" +Ok "Docker: $(cmd /c 'docker compose version --short 2>NUL')" # --- Check RAM ------------------------------------------------------------ $TotalRamGb = [math]::Round((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB, 1) @@ -116,7 +121,8 @@ if ($LASTEXITCODE -ne 0) { Err "docker compose up fallo (exit $LASTEXITCODE)."; Warn 'Descargando modelo de IA (llama3.2:3b, ~2 GB)...' $MaxWait = 60; $Waited = 0 while ($true) { - docker exec d0a1-ollama ollama ps *> $null + # Descarte de stderr via cmd /c (ver nota de PS 5.1 / PS #4002 arriba) + cmd /c "docker exec d0a1-ollama ollama ps >NUL 2>&1" if ($LASTEXITCODE -eq 0) { break } Start-Sleep -Seconds 2 $Waited += 2 diff --git a/wordpress/deploy.ps1 b/wordpress/deploy.ps1 index 2ab7d4c..9608df3 100644 --- a/wordpress/deploy.ps1 +++ b/wordpress/deploy.ps1 @@ -61,16 +61,21 @@ if (-not (Get-Command docker -ErrorAction SilentlyContinue)) { Write-Host ' https://docs.docker.com/desktop/setup/install/windows-install/' exit 1 } -try { docker info *> $null } catch { +# En PS 5.1, *> $null sobre comandos nativos convierte stderr en errores +# terminantes con EAP=Stop (PS #4002). Se descarta via cmd /c. +if (-not (cmd /c "docker info >NUL 2>&1")) { Err 'Docker Desktop no responde. Abre Docker Desktop y espera a que arranque.' exit 1 } -try { docker compose version *> $null; $composeOk = $true } catch { $composeOk = $false } +# En PS 5.1, *> $null sobre comandos nativos convierte stderr en errores +# terminantes con EAP=Stop (PS #4002). Se descarta via cmd /c. +cmd /c "docker compose version >NUL 2>&1" +$composeOk = ($LASTEXITCODE -eq 0) if (-not $composeOk) { Err 'Docker Compose v2 no disponible. Actualiza Docker Desktop.' exit 1 } -Ok "Docker: $(docker compose version --short 2>$null)" +Ok "Docker: $(cmd /c 'docker compose version --short 2>NUL')" # --- Check RAM ------------------------------------------------------------ $TotalRamGb = [math]::Round((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB, 1) @@ -154,7 +159,8 @@ if ($LASTEXITCODE -ne 0) { Err "docker compose up fallo (exit $LASTEXITCODE)."; Warn 'Descargando modelo de IA (llama3.2:3b, ~2 GB)...' $MaxWait = 60; $Waited = 0 while ($true) { - docker exec d0a1-wp-ollama ollama ps *> $null + # Descarte de stderr via cmd /c (ver nota de PS 5.1 / PS #4002 arriba) + cmd /c "docker exec d0a1-wp-ollama ollama ps >NUL 2>&1" if ($LASTEXITCODE -eq 0) { break } Start-Sleep -Seconds 2 $Waited += 2