When PowerShell is installed as a .NET global tool, it prepends its own $PSHOME folder to $env:PATH.
However, on macOS $PSHOME contains an incompatible pwsh binary that is for Linux.
Therefore, from within an existing session, invoking pwsh (by mere file name) unexpectedly fails.
Steps to reproduce
# Install PowerShell as a .NET global tool, to ~/.dotnet/tools
dotnet tool install powershell -g
# Invoke it, and try to re-invoke its own CLI.
~/.dotnet/tools/pwsh -noprofile -c 'pwsh -noprofile -c write-output hi' | Should -Be 'hi'
Expected behavior
The test should succeed.
Actual behavior
The test fails, due to incompatible binary being invoked:
Expected 'hi', but got @('ResourceUnavailable: Program 'pwsh' failed to run: Exec format errorAt line:1 char:1' ...
Environment data
PowerShell Core v7.0.0 (7.0.0) on macOS 10.15.3
When PowerShell is installed as a .NET global tool, it prepends its own
$PSHOMEfolder to$env:PATH.However, on macOS
$PSHOMEcontains an incompatiblepwshbinary that is for Linux.Therefore, from within an existing session, invoking
pwsh(by mere file name) unexpectedly fails.Steps to reproduce
Expected behavior
The test should succeed.
Actual behavior
The test fails, due to incompatible binary being invoked:
Environment data