-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get-OSArchitectureWidth doesn't do what it says it does #828
Comments
Current function should be changed from
to
|
Looks good |
Get-OSArchitectureWidth returns the current process bit-width regardless of OS arch. So in 32-bit powershell running on 64-bit windows, it returns 32 because [System.IntPtr]::Size returns 4 in 32-bit process regardless of OS architecture (32 or 64). This fix returns actual OS bit width.
How about adding parameter switches to this helper? so
or would If I had a blank slate to work with, I would do |
Checking process is simply It is currently being used in 2 helpers: Install-ChocolateyVsixPackage.ps1#L113 I can't think of any packages that were using |
I'd vote for Get-OSBitness and Get-ProcessBitness, personally. |
Get-OSArchitectureWidth returns the current process bit-width regardless of OS arch. So in 32-bit powershell running on 64-bit windows, it returns 32 because [System.IntPtr]::Size returns 4 in 32-bit process regardless of OS architecture (32 or 64). This fix returns actual OS bit width.
* pr831: (GH-828) Return OS bit width, not process
* stable: (GH-828) Return OS bit width, not process
Merged into stable at 45ccd77 |
Get-OSArchitectureWidth is not the most intuitive name, so add Get-OSBitness as an alias that can be used.
* stable: (doc) update generated docs (GH-828) Add Alias Get-OSBitness
Ref: #713 Rename Get-ProcessorBits as a more appropriately named Get-OSArchitectureWidth
Get-OSArchitectureWidth
returns the current process bit-width regardless of OS arch. So in 32-bit powershell running on 64-bit windows, it returns32
because[System.IntPtr]::Size
returns4
in 32-bit process regardless of OS architecture (32 or 64)The helper should be replaced by testing whether process is running on 64-bit OS if the intent is to return what the helper says it will.
So if
[System.IntPtr]::Size
returns4
, also dotest-path env:\PROCESSOR_ARCHITEW6432
The text was updated successfully, but these errors were encountered: