-
Notifications
You must be signed in to change notification settings - Fork 510
[Query] Can you add a WSL installed version of PowerShell Core as a session option on Windows? #1544
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
Comments
My initial thoughts are that this should be able to be surfaced using the |
The Otherwise, we should invest in something similar to #1470. My only concern would be allowing arbitrary commands to be executed in configurations - we would need to manage that carefully. But I would imagine the best way to find out is to play with it a bit |
Well, starting pwsh in WSL is only part of what's needed. I don't "think" Windows pipes work as an interop mechanism between Windows and WSL, so we'd have to provide an option to use the old TCPIP sockets IPC. Or maybe use domain sockets between Windows and WSL - https://blogs.msdn.microsoft.com/commandline/2018/02/07/windowswsl-interop-with-af_unix/ |
So I have set up the following in my settings "powershell.powerShellAdditionalExePaths": [ {
"versionName":"WSL-Ubuntu",
"exePath": "C:\\WINDOWS\\system32\\wsl.exe /opt/microsoft/powershell/6/pwsh"
},
{
"versionName":"WSL-Ubuntu-Path",
"exePath": "C:\\WINDOWS\\system32\\wsl.exe"
},
{
"versionName":"DockerImage",
"exePath": "C:\\Program Files\\Docker\\Docker\\Resources\\bin\\docker.exe run -it microsoft/powershell"
}
],
when I try to open the 9/28/2018 8:59:30 AM [NORMAL] - Visual Studio Code v1.27.2 64-bit
9/28/2018 8:59:30 AM [NORMAL] - PowerShell Extension v1.8.4
9/28/2018 8:59:30 AM [NORMAL] - Operating System: Windows 64-bit
9/28/2018 8:59:30 AM [NORMAL] - Path specified by 'powerShellExePath' setting - 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run -it microsoft/powershell' - not found, reverting to default PowerShell path.
9/28/2018 8:59:30 AM [NORMAL] - Language server starting --
9/28/2018 8:59:30 AM [NORMAL] - exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
9/28/2018 8:59:30 AM [NORMAL] - args: C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.8.4'-AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\modules'-EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\logs\1538121570-1d5f6bf0-fc93-40d6-8e83-a767fa8140f31538121561775\EditorServices.log' -SessionDetailsPath 'C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\sessions\PSES-VSCode-7112-175093' -FeatureFlags @()
9/28/2018 8:59:30 AM [NORMAL] - Syntax Folding Provider registered
9/28/2018 8:59:33 AM [NORMAL] - Language server started.
9/28/2018 8:59:33 AM [NORMAL] - {"status":"started","debugServiceTransport":"NamedPipe","languageServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_34aa6310-7088-4a53-94b8-d52475a62b35","languageServicePipeName":"\\\\.\\pipe\\PSES_057985a6-5a2a-48a5-9475-4ea31c003836"}
9/28/2018 8:59:33 AM [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_057985a6-5a2a-48a5-9475-4ea31c003836...
9/28/2018 8:59:33 AM [NORMAL] - Language service connected.
9/28/2018 8:59:34 AM [NORMAL] - powershell.exe started, pid: 20108
9/28/2018 8:59:38 AM [NORMAL] - Shutting down language client...
9/28/2018 8:59:38 AM [NORMAL] - Terminating PowerShell process...
9/28/2018 8:59:38 AM [NORMAL] - Path specified by 'powerShellExePath' setting - 'C:\WINDOWS\system32\wsl.exe /opt/microsoft/powershell/6/pwsh' - not found, reverting to default PowerShell path.
9/28/2018 8:59:38 AM [NORMAL] - Language server starting --
9/28/2018 8:59:38 AM [NORMAL] - exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
9/28/2018 8:59:38 AM [NORMAL] - args: C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.8.4'-AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\modules'-EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\logs\1538121578-1d5f6bf0-fc93-40d6-8e83-a767fa8140f31538121561775\EditorServices.log' -SessionDetailsPath 'C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\sessions\PSES-VSCode-7112-675313' -FeatureFlags @()
9/28/2018 8:59:39 AM [NORMAL] - powershell.exe started, pid: 10256
9/28/2018 8:59:40 AM [NORMAL] - Language server started.
9/28/2018 8:59:40 AM [NORMAL] - {"status":"started","debugServiceTransport":"NamedPipe","languageServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_7993a509-c6fc-4849-bfd3-7285cadd9183","languageServicePipeName":"\\\\.\\pipe\\PSES_3f6d9ca4-a60c-4a3d-9f39-d178d4b4e339"}
9/28/2018 8:59:40 AM [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_3f6d9ca4-a60c-4a3d-9f39-d178d4b4e339...
9/28/2018 8:59:40 AM [NORMAL] - Language service connected.
9/28/2018 9:12:54 AM [NORMAL] - Shutting down language client...
9/28/2018 9:12:54 AM [NORMAL] - Terminating PowerShell process...
9/28/2018 9:12:54 AM [NORMAL] - Path specified by 'powerShellExePath' setting - 'C:\WINDOWS\system32\wsl.exe /opt/microsoft/powershell/6/pwsh' - not found, reverting to default PowerShell path.
9/28/2018 9:12:54 AM [NORMAL] - Language server starting --
9/28/2018 9:12:54 AM [NORMAL] - exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
9/28/2018 9:12:54 AM [NORMAL] - args: C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.8.4'-AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\modules'-EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\logs\1538122374-1d5f6bf0-fc93-40d6-8e83-a767fa8140f31538121561775\EditorServices.log' -SessionDetailsPath 'C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\sessions\PSES-VSCode-7112-201235' -FeatureFlags @()
9/28/2018 9:12:55 AM [NORMAL] - powershell.exe started, pid: 2024
9/28/2018 9:12:56 AM [NORMAL] - Language server started.
9/28/2018 9:12:56 AM [NORMAL] - {"status":"started","debugServiceTransport":"NamedPipe","languageServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_90950b52-217e-40e4-9c2b-6dabab4bc09a","languageServicePipeName":"\\\\.\\pipe\\PSES_50d7545f-cf09-4f82-a643-89f482e0a2a2"}
9/28/2018 9:12:56 AM [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_50d7545f-cf09-4f82-a643-89f482e0a2a2...
9/28/2018 9:12:56 AM [NORMAL] - Language service connected.
9/28/2018 9:13:00 AM [NORMAL] - Shutting down language client...
9/28/2018 9:13:00 AM [NORMAL] - Terminating PowerShell process...
9/28/2018 9:13:00 AM [NORMAL] - Language server starting --
9/28/2018 9:13:00 AM [NORMAL] - exe: C:\WINDOWS\system32\wsl.exe
9/28/2018 9:13:00 AM [NORMAL] - args: C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.8.4'-AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\modules'-EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\logs\1538122380-1d5f6bf0-fc93-40d6-8e83-a767fa8140f31538121561775\EditorServices.log' -SessionDetailsPath 'C:\Users\ryan\.vscode\extensions\ms-vscode.powershell-1.8.4\sessions\PSES-VSCode-7112-926887' -FeatureFlags @()
9/28/2018 9:13:01 AM [NORMAL] - powershell.exe started, pid: 16580
9/28/2018 9:13:01 AM [NORMAL] - powershell.exe terminated or terminal UI was closed
9/28/2018 9:15:00 AM [NORMAL] - Language server startup failed.
9/28/2018 9:15:00 AM [ERROR] - The language service could not be started:
9/28/2018 9:15:00 AM [ERROR] - Timed out waiting for session file to appear. When I try calling the I'm speculating here, but I think this looks more and more likely this might not be able to be done all that easily. |
From what I can tell, the exePath can't take any arguments. Also, I really don't think it would be this easy. Here's some concerns/questions I have directed at no one in particular, just food for thought.
I could be totally off base and all of these concerns could be invalid, but if they aren't, then it would be a non-trivial amount of development to get this working. (Not saying it won't or shouldn't happen, only that I doubt this will be a simple config change) |
Yeah, I think we'd have to resurrect the TCPIP/sockets IPC mechanism for this and we'd have to add support for arguments for the |
Seems like another good case for bringing back TCP connections to me :) |
It sounds like this would be a headache to get implemented. However if it were to be able to happen then it would be an awesome addition especially for xPlat testing |
Today you can get this to work by double checking the ssh server is running on wsl and then use PowerShell Remoting over ssh. This would also work for containers |
FYI, this was broken pre-1.10.0 but now we handle local remoting sessions better. Here's a screenshot of editing a script from WSL: Steps:
Enter-PSSession -Hostname username@localhost:5522 From here you can use I think this is a reasonable experience for WSL and containers. We can rely on PowerShell Remoting to do the right thing here. Gonna close this for now, please let me know if you feel otherwise. |
The scenario (which may/maynot be possible) would be to have VSCode on Windows be able to add in a WSL session of PowerShell Core on Windows machines
This assumes
WSL feature is installed
Ubuntu image installed
Pwsh installed in Ubuntu WSL
If this were possible then that would help local xplat development in VSCode eve further than currently
The text was updated successfully, but these errors were encountered: