Skip to content

fix(install.ps1): 原生命令 stderr 在 Stop 下误抛 NativeCommandError - #456

Merged
bigbrother666sh merged 1 commit into
TeamWiseFlow:masterfrom
bigbrother666sh:fix/win-install-ps1-stderr-stop
Jul 22, 2026
Merged

fix(install.ps1): 原生命令 stderr 在 Stop 下误抛 NativeCommandError#456
bigbrother666sh merged 1 commit into
TeamWiseFlow:masterfrom
bigbrother666sh:fix/win-install-ps1-stderr-stop

Conversation

@bigbrother666sh

Copy link
Copy Markdown
Member

用户 Win 实测 install.ps1 卡在 Installing python skill deps

python.exe : ... NativeCommandError ... RemoteException
+     & python -m pip install --user $merged 2>&1 | ForEach-Object { Wr ...

根因:脚本顶部 $ErrorActionPreference="Stop" + 原生命令 2>&1 合并进管道 → stderr 行变 ErrorRecord → Stop 当 terminating error 抛 NativeCommandError/RemoteException。pip install 正常把进度条/警告写 stderr,所以一跑就炸。

修法:加 Invoke-Streamed helper,临时切 $ErrorActionPreference='Continue' 跑原生命令并按行回显 stdout+stderr,$LASTEXITCODE 仍由调用方判成败。替换 6 处 2>&1 | ForEach-Object { Write-Host } 调用点:pip / camoufox-cli install / openclaw plugins install / daemon install / gateway restart×2。

其余原生调用(pnpm/npm/bash/tar/channels login)未走 2>&1,stderr 直写控制台不触发 Stop,不动。

install.ps1 走 raw URL 拉取(irm raw.githubusercontent.com/.../master/scripts/install.ps1 | iex),合到 master 即生效,无需重建 tarball。

$ErrorActionPreference='Stop' + 原生命令 2>&1 合并进管道 → stderr 行变 ErrorRecord
→ Stop 当 terminating error 抛 NativeCommandError/RemoteException。pip install 正常把
进度条/警告写 stderr,用户 Win 实测卡在 'Installing python skill deps' 这步。

修法:加 Invoke-Streamed helper,临时切 $ErrorActionPreference='Continue' 跑原生命令
并按行回显 stdout+stderr,$LASTEXITCODE 仍由调用方判成败。替换 6 处
'2>&1 | ForEach-Object { Write-Host }' 调用点:pip / camoufox-cli install /
openclaw plugins install / daemon install / gateway restart×2。其余原生调用
(pnpm/npm/bash/tar/channels login)未走 2>&1,stderr 直写控制台不触发 Stop,不动。
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


codes-factory-of-bg seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@bigbrother666sh
bigbrother666sh merged commit c6cdb3e into TeamWiseFlow:master Jul 22, 2026
2 of 3 checks passed
@bigbrother666sh
bigbrother666sh deleted the fix/win-install-ps1-stderr-stop branch July 22, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants