mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 09:34:46 +00:00
fix(install): don't abort install.ps1 when git writes to stderr (#80834)
PowerShell 7+ honors $ErrorActionPreference=Stop for native commands,
so git's normal progress line ("From https://...") on stderr during
`git pull --rebase` would turn into a terminating error and abort the
installer immediately after a fresh clone — before pnpm install/build
ever runs. The existing `2>$null` redirects the display but the error
record is still generated.
Wrap the git status / pull calls in try/catch so the pull stays
best-effort and the rest of the installer can proceed. Reproduced on
Windows 11 ARM under PowerShell 7.x with -InstallMethod git.
This commit is contained in:
@@ -568,8 +568,13 @@ function Install-OpenClawFromGit {
|
||||
}
|
||||
|
||||
if (-not $SkipUpdate) {
|
||||
if (-not (git -C $RepoDir status --porcelain 2>$null)) {
|
||||
git -C $RepoDir pull --rebase 2>$null
|
||||
# PowerShell 7+ surfaces native-command stderr as terminating errors when
|
||||
# $ErrorActionPreference=Stop, so git's normal "From <url>" progress line
|
||||
# would abort the script. Swallow failures here — pull is best-effort.
|
||||
$dirty = $null
|
||||
try { $dirty = git -C $RepoDir status --porcelain 2>$null } catch {}
|
||||
if (-not $dirty) {
|
||||
try { git -C $RepoDir pull --rebase 2>$null } catch {}
|
||||
} else {
|
||||
Write-Host "[!] Repo is dirty; skipping git pull" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user