Skip to content
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

vscode.env.shell doesn't report correctly terminal when a new shell of different type is opened without changing the default setting #127374

Closed
karrtikr opened this issue Jun 28, 2021 · 3 comments
Assignees
Labels
*as-designed Described behavior is as designed

Comments

@karrtikr
Copy link
Contributor

karrtikr commented Jun 28, 2021

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.57.1 (user setup)
  • OS Version:Windows_NT x64 10.0.19043

Hi Python extension dev here 👋

Steps to Reproduce:

  1. Open a different type of terminal directly (for eg. git bash) using the icon.

  1. Subscribe to the vscode.window.onDidOpenTerminal event. Try to get the active terminal type using vscode.env.shell. It still reports the default shell. This leads to us sending the wrong activation commands.

  2. Even if we wait a little, the API always reports the default shell instead.

We can also replace step 1 with vscode.window.createTerminal(undefined, 'C:\\Windows\\System32\\cmd.exe') instead of using the icon, and notice 'C:\\Windows\\System32\\cmd.exe' is not reported via the API.

cc @Tyriar

@Tyriar
Copy link
Member

Tyriar commented Jun 28, 2021

vscode.env.shell always returns the default by design. To find what the shell is you should look at the Terminal object on vscode.window.onDidOpenTerminal

@Tyriar Tyriar closed this as completed Jun 28, 2021
@Tyriar Tyriar added the *as-designed Described behavior is as designed label Jun 28, 2021
@karrtikr
Copy link
Contributor Author

karrtikr commented Jun 28, 2021

I see, thanks for pointing it out. Just so I understand correctly, we should first look at Terminal.creationOptions.shellPath, and if it's not set, then fallback to vscode.env.shell API, correct?

@Tyriar
Copy link
Member

Tyriar commented Jun 28, 2021

Yes if the creationOptions aren't set then it will use vscode.env.shell since an undefined value for the shell means it uses the default.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed
Projects
None yet
Development

No branches or pull requests

3 participants