microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.55k stars 8.31k forks source link

Doesn't detect pwsh installed in custom directory from Scoop #8264

Open kurame-yotsuba opened 3 years ago

kurame-yotsuba commented 3 years ago

Environment

Windows build number: 10.0.19042.0 Windows Terminal version (if applicable): 1.4.3141.0

PowerShell Core: 7.1.0 Scoop

Steps to reproduce

  1. Installing Scoop to Custom Directory
  2. Install PowerShell Core via Scoop
  3. Open Windows Terminal

Expected behavior

When environment variable SCOOP or SCOOP_GLOBAL is defined, Terminal should search pwsh.exe in %SCOOP% and %SCOOP_GLOBAL% in addition to %USERPROFILE%\scoop.

Actual behavior

Error dialog is opened. The content of error message is "An error occurred while loading the settings." (Sorry, I don't know the message of English version because I use Japanese version).

And, PowerShell is used instead, and PowerShell Core doesn't appear in the shell list.

Searching place is only %USERPROFILE%scoop for Scoop. (ref: PowershellCoreProfileGenerator.cpp Line 281, Tag 1.4.3141.0)

Related issue

1415

zadjii-msft commented 3 years ago

Thanks for reporting this! I didn't know about the %scoop% env var and the ability to install scoop to a custom directory. Probably wouldn't be too hard to fix this...

/cc @DHowett

DHowett commented 3 years ago

Is it guaranteed that SCOOP and SCOOP_GLOBAL are set?

Every location we search needs a differentiator; otherwise, we may detect three instances of PowerShell and they'll collapse into one. Right now, we only have one Scoop differentiator.

mpela81 commented 3 years ago

I think those variables are not set by default (I don't find them in my system).

From the documentation here, it looks like you can change the directory for user-installed programs and global-installed programs independently.

kurame-yotsuba commented 3 years ago

In my case too, those variables were not set by default before changing into custom directory.

Using Scoop, we can install following 4 locations,

To decide which PowerShell is used from these, I think the priorities of search is needed.

JVimes commented 1 year ago

I think checking %PATH% first would largely solve the problem. pwsh.exe is in PATH by default when installing either way (scoop or official .msi).