fix:解决Windows平台下脚本失败问题#464
Merged
phantom5099 merged 2 commits into1024XEngineer:mainfrom Apr 26, 2026
Merged
Conversation
…System.Runtime.InteropServices.RuntimeInformation] 类的 ProcessArchitecture 属性可能未定义或无法正确求值,从而向脚本返回 。
| } | ||
|
|
||
| $Architecture = [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToUpperInvariant() | ||
| $Architecture = $env:PROCESSOR_ARCHITECTURE.ToUpperInvariant() |
There was a problem hiding this comment.
$env:PROCESSOR_ARCHITECTURE reflects the current PowerShell process architecture, not always the OS architecture. In a 32-bit shell on a 64-bit OS this can be x86, causing an Unsupported architecture failure even when an x86_64 asset should be installable. Consider resolving architecture with PROCESSOR_ARCHITEW6432 (when set) before PROCESSOR_ARCHITECTURE, and add a null/empty guard before calling ToUpperInvariant().
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Collaborator
|
这边测试之后可以用了吗 |
Collaborator
Author
可以,你可自行验证,将这次修改的脚本下载至本地,在powershell中使用 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
原因:在基于较老版本 .NET Framework 的 PowerShell 5.1 中,[System.Runtime.InteropServices.RuntimeInformation] 类的 ProcessArchitecture 属性可能未定义或无法正确求值,从而向脚本返回 。