Skip to content

restarting Integrated Console does not respect powershell.powerShellDefaultVersion setting #1586

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
fbehrens opened this issue Oct 16, 2018 · 6 comments
Labels

Comments

@fbehrens
Copy link

System Details

System Details Output

### VSCode version: 1.28.1 3368db6750222d319c851f6d90eb619d886e08f5 x64

### VSCode extensions:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]


### PSES version: 1.9.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.14393.2485
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.2485
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I have set the setting"powershell.powerShellDefaultVersion": "Windows PowerShell (x86)"

When I start code and the Powershell Integrated Terminal is and shows the correct Version(5.1 (x86))
image

When I kill the Terminal
image

and say YES, I like to restart it.

I am not getting an Windows PowerShell (x86) ,

but a 64bit

image

Attached Logs

Here are diagnostics log
logs.zip

@rjmholt
Copy link
Contributor

rjmholt commented Oct 16, 2018

It looks like this is deliberate:

// If powershell.powerShellDefaultVersion specified, attempt to find the PowerShell exe path
// of the version specified by the setting.
if ((this.sessionStatus === SessionStatus.NeverStarted) && this.sessionSettings.powerShellDefaultVersion) {
const powerShellExePaths = getAvailablePowerShellExes(this.platformDetails, this.sessionSettings);
const powerShellDefaultVersion =
powerShellExePaths.find((item) => item.versionName === this.sessionSettings.powerShellDefaultVersion);
if (powerShellDefaultVersion) {
powerShellExePath = powerShellDefaultVersion.exePath;
} else {
this.log.writeWarning(
`Could not find powerShellDefaultVersion: '${this.sessionSettings.powerShellDefaultVersion}'`);
}
}

@rkeithhill do you know what powerShellDefaultVersion is supposed to mean here? Is this a by-design scenario?

@fbehrens If you set the powershellExePath setting instead, that will be honoured.

@rjmholt rjmholt added Issue-Discussion Let's talk about it. Area-General labels Oct 16, 2018
@rkeithhill
Copy link
Contributor

rkeithhill commented Nov 24, 2018

From the configuration comments:

  // Specifies the name of the PowerShell version used in the startup session 
  // when the extension loads e.g "Windows PowerShell (x86)" or "PowerShell Core 6.0.2 (x64)".
  "powershell.powerShellDefaultVersion": "",

The above is a true "user" preference while this:

  // Specifies the full path to a PowerShell executable. Changes the installation 
  // of PowerShell used for language and debugging services.
  "powershell.powerShellExePath": "",

is what the "extension" uses to store the last selected PowerShell version's path.

@eedwards-sk
Copy link

I just ran into this while using multiple powershell versions.

    "powershell.powerShellAdditionalExePaths": [
        {
            "exePath": "/usr/local/bin/pwsh",
            "versionName": "pwsh"
        },
        {
            "exePath": "/usr/local/bin/pwsh-preview",
            "versionName": "pwsh-preview"
        }
    ],
    "powershell.powerShellDefaultVersion": "pwsh-preview"

after closing the integrated terminal using the trashcan, and re-opening it using the warning dialog (as per the issue author), it loads pwsh instead of pwsh-preview:

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.2.2
PSEdition                      Core
GitCommitId                    6.2.2
OS                             Darwin 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Aug 15, 2019
@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Aug 16, 2019
@davesbrown
Copy link

davesbrown commented Mar 9, 2020

seems to be loading 7 by default even when changing
"powershell.powerShellDefaultVersion": "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe"

Some more digging: using the settings ui both 5.1 and 7 have a
Switch to: Powershell (x64)

only after being in 7.0 will you see that you are in current session of 7.0

The two different settings used in the settings.json are:
PowerShell (x64)
Windows Powershell (x64)

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Mar 9, 2020
@rjmholt
Copy link
Contributor

rjmholt commented Mar 10, 2020

seems to be loading 7 by default even when changing
"powershell.powerShellDefaultVersion": "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe"

The default needs to be specified by name rather than path; try:

"powerShell.powerShellDefaultVersion": "Windows PowerShell (x64)"

@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Mar 10, 2020
@TylerLeonhardt
Copy link
Member

The original issue is fixed now. If you still see this behavior please let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants