Skip to content

fix(windows): 支持 PowerShell 7.6 启动 - #332

Open
Q-xuan wants to merge 1 commit into
zerx-lab:mainfrom
Q-xuan:fix-pwsh76-conpty-remove-module
Open

fix(windows): 支持 PowerShell 7.6 启动#332
Q-xuan wants to merge 1 commit into
zerx-lab:mainfrom
Q-xuan:fix-pwsh76-conpty-remove-module

Conversation

@Q-xuan

@Q-xuan Q-xuan commented Jul 30, 2026

Copy link
Copy Markdown

改了啥

zap 在 PowerShell 7.6 下直接打不开,显示「Shell 进程过早退出」。查下来是两个问题:

1. Remove-Module 报错

pwsh_init_shell.ps1 第二行:

Remove-Module -Name PSReadline

PS 7.6 不再在 -NoProfile 模式下自动加载 PSReadLine 了,所以这行会抛终止错误("No modules were removed"),pwsh 直接退出。

修复:加 -ErrorAction Ignore

2. ConPTY 版本太旧,和 PS 7.6 / .NET 10 不兼容

这是真正让 pwsh 退出的原因。zap bundle 的 conpty.dll (96KB) 和 OpenConsole.exe (1121KB) 是旧版,PS 7.6 的 .NET 10 runtime 调用 GetConsoleScreenBufferInfo 时 ConPTY pipe 断开,pwsh 触发 FailFast 退出,exit code 0x80131623

修复:更新到新版 conpty.dll (112KB) + OpenConsole.exe (1134KB)。

Warp 官方也有同样的问题(#11398),WezTerm 已经更新修复了(wezterm#7774)。

验证

用更新后的 conpty.dll + OpenConsole.exe + Remove-Module -ErrorAction Ignore,PS 7.6.3 可以正常启动。

1. Remove-Module -ErrorAction Ignore

PS 7.6 不再在 -NoProfile 下自动加载 PSReadLine,
Remove-Module -Name PSReadline 会抛终止错误导致 pwsh 退出。
加 -ErrorAction Ignore 即可。

2. 更新 ConPTY 到兼容 .NET 10 / PS 7.6 的版本

旧版 ConPTY (conpty.dll 96KB / OpenConsole.exe 1121KB)
与 PS 7.6 的 .NET 10 runtime 不兼容:
调用 GetConsoleScreenBufferInfo 时 ConPTY pipe 断开,
pwsh 触发 FailFast 退出 (exit code 0x80131623)。
更新到新版 (conpty.dll 112KB / OpenConsole.exe 1134KB) 修复。

相关 issue:
- warpdotdev#11398
- wezterm/wezterm#7774
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.

1 participant