Skip to content

Enumeration of PowerShell versions doesn't work on macOS #1251

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

Closed
bagrupe opened this issue Mar 30, 2018 · 4 comments
Closed

Enumeration of PowerShell versions doesn't work on macOS #1251

bagrupe opened this issue Mar 30, 2018 · 4 comments
Labels
Area-Configuration Issue-Enhancement A feature request (enhancement).

Comments

@bagrupe
Copy link

bagrupe commented Mar 30, 2018

After installing pscore 6.1.0-preview1 I expected to be able to switch between 6.0 and 6.1 via clicking on the version in the status bar, but it seems the directory /usr/local/microsoft/powershell/ is being ignored. I have the following versions installed:

ls -l
drwxr-xr-x  226 root  wheel  7232 Jan  9 20:40 6.0.0
drwxr-xr-x  230 root  wheel  7360 Sep 13  2017 6.0.0-beta.7
drwxr-xr-x  226 root  wheel  7232 Oct 24 23:38 6.0.0-beta.9
drwxr-xr-x  226 root  wheel  7232 Nov 18 02:31 6.0.0-rc
drwxr-xr-x  226 root  wheel  7232 Dec 13 01:24 6.0.0-rc.2
drwxr-xr-x  227 root  wheel  7264 Mar 13 21:49 6.0.2
drwxr-xr-x  227 root  wheel  7264 Mar 22 19:55 6.1.0-preview.1

If I use any of these versions directly, I will get the option to "Switch to PowerShellCore" which will then point to /usr/local/bin/pwsh directly.

System Details

  • Operating system name and version: macOS 10.13.4
  • VS Code version: 1.12.1
  • PowerShell extension version: 1.6.0
  • Output from $PSVersionTable:
PSVersion                      6.1.0-preview.1
PSEdition                      Core
GitCommitId                    v6.1.0-preview.1
OS                             Darwin 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar  5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64
Platform                       Unix

On my Windows machine, switching between versions works flawlessly.

@TylerLeonhardt
Copy link
Member

Thanks for this! We've been having some discussions recently about this experience.

Right now, "PowerShell Core" just uses wherever is symlnked to /usr/local/bin/pwsh but it would be nice to be able to discover all the side-by-side versions and select from all of them.

@bagrupe
Copy link
Author

bagrupe commented Apr 1, 2018

I looked into platform.ts and basically you'd have to expand the currently windows-only section on line 143-162 with the paths for linux or macOS respectively:

if (platformDetails.operatingSystem === OperatingSystem.Windows) {
const psCoreInstallPath =
            (!platformDetails.isProcess64Bit ? process.env.ProgramW6432 : process.env.ProgramFiles) + "\\PowerShell";
# rest of the Windows specific block
} else {
const psCoreInstallPath = "/usr/local/microsoft/powershell";
}

if (fs.existsSync(psCoreInstallPath)) {
# ...
}

I'm just assuming here that Linux uses the same path (haven't checked).

@TylerLeonhardt TylerLeonhardt added Issue-Enhancement A feature request (enhancement). Area-General labels Apr 3, 2018
@TylerLeonhardt
Copy link
Member

@rkeithhill is doing some work on enumeration. This should get fixed with that change - I'll help him verify on mac.

The related issues:
#1242
#1243

@SydneyhSmith
Copy link
Collaborator

PowerShell changed the file path scheme to only have a /6/ and a /6-preview/ this means that these side by side versions cannot be picked up because they are unguessable --closing as a result since we do pick up both pwsh and pwsh-preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Configuration Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests

4 participants