mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-26 16:06:16 +00:00
fix: tolerate npm stderr in Windows Parallels update smoke
This commit is contained in:
@@ -186,18 +186,25 @@ function Invoke-Logged {
|
|||||||
[Parameter(Mandatory = $true)][scriptblock]$Command
|
[Parameter(Mandatory = $true)][scriptblock]$Command
|
||||||
)
|
)
|
||||||
|
|
||||||
|
$output = $null
|
||||||
$previousErrorActionPreference = $ErrorActionPreference
|
$previousErrorActionPreference = $ErrorActionPreference
|
||||||
$previousNativeErrorPreference = $PSNativeCommandUseErrorActionPreference
|
$previousNativeErrorPreference = $PSNativeCommandUseErrorActionPreference
|
||||||
try {
|
try {
|
||||||
$ErrorActionPreference = 'Continue'
|
$ErrorActionPreference = 'Continue'
|
||||||
$PSNativeCommandUseErrorActionPreference = $false
|
$PSNativeCommandUseErrorActionPreference = $false
|
||||||
& $Command *>> $LogPath
|
# Merge native stderr into stdout before logging so npm/openclaw warnings do not
|
||||||
|
# surface as PowerShell error records and abort a healthy in-place update.
|
||||||
|
$output = & $Command *>&1
|
||||||
$exitCode = $LASTEXITCODE
|
$exitCode = $LASTEXITCODE
|
||||||
} finally {
|
} finally {
|
||||||
$ErrorActionPreference = $previousErrorActionPreference
|
$ErrorActionPreference = $previousErrorActionPreference
|
||||||
$PSNativeCommandUseErrorActionPreference = $previousNativeErrorPreference
|
$PSNativeCommandUseErrorActionPreference = $previousNativeErrorPreference
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($null -ne $output) {
|
||||||
|
$output | Tee-Object -FilePath $LogPath -Append | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
if ($exitCode -ne 0) {
|
if ($exitCode -ne 0) {
|
||||||
throw "$Label failed with exit code $exitCode"
|
throw "$Label failed with exit code $exitCode"
|
||||||
}
|
}
|
||||||
@@ -214,7 +221,7 @@ function Invoke-CaptureLogged {
|
|||||||
try {
|
try {
|
||||||
$ErrorActionPreference = 'Continue'
|
$ErrorActionPreference = 'Continue'
|
||||||
$PSNativeCommandUseErrorActionPreference = $false
|
$PSNativeCommandUseErrorActionPreference = $false
|
||||||
$output = & $Command 2>&1
|
$output = & $Command *>&1
|
||||||
$exitCode = $LASTEXITCODE
|
$exitCode = $LASTEXITCODE
|
||||||
} finally {
|
} finally {
|
||||||
$ErrorActionPreference = $previousErrorActionPreference
|
$ErrorActionPreference = $previousErrorActionPreference
|
||||||
|
|||||||
Reference in New Issue
Block a user