microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.6k stars 273 forks source link

Can not remote-ssh by VS code when Oh-my-posh is installed on powershell #5499

Open QuYue opened 3 years ago

QuYue commented 3 years ago

Issue Type: Bug

When I intsall Oh-my-posh (v3) on my powershell in my computer. The other computer can not remote this computer by remote-ssh function in Vscode. It will stop in "initial Vs code server" process.

VS Code version: Code 1.59.1 (3866c3553be8b268c8a7f8c0482c0c0177aa8bfa, 2021-08-19T11:56:46.957Z) OS version: Windows_NT x64 10.0.19042 Restricted Mode: No

roblourens commented 3 years ago

Could you share the log from the Remote-SSH output channel when it fails?

QuYue commented 3 years ago
屏幕截图 2021-08-24 105538
QuYue commented 3 years ago

If I add the command Set-PoshPrompt -Theme D:\Others\My_Config\quyue.omp.json to my $profile (Microsoft.Powershell_profile.ps1)file in my server. The other computers can not connect to my server by Remote-ssh function.

QuYue commented 3 years ago

image

QuYue commented 3 years ago

More interestingly, the server even can not connect itself by remote -ssh.

roblourens commented 2 years ago

We expect the string Windows PowerShell to be written. We need a predictable string to wait for. If we send the script over before powershell has fully started, we can lose data.

I don't know how to fix this in general. It would be really helpful if someone can tell me what configuration exactly in Oh-My-Posh changes this. You could work around it by changing your powershell profile to output this string.

Jack-Works commented 2 years ago

Having this problem too when using oh-my-posh built-in theme

Import-Module oh-my-posh;
Set-PoshPrompt -Theme cert;

We expect the string Windows PowerShell to be written. We need a predictable string to wait for.

What is that string?

Jack-Works commented 2 years ago

Using theme:

PowerShell 7.1.4
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

Loading personal and system profiles took 1277ms.
 Jack@Jack-SB3   Workspace   

Not using theme (-NoProfile):

PowerShell 7.1.4
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS C:\Users\Jack\Workspace>

I didn't see the string Windows PowerShell in the latter version too.

QuYue commented 2 years ago

Ok, thank you very much @roblourens. Now, I don't use oh-my-posh anymore.

QuYue commented 2 years ago

Yes, when the powershell shows "loading personal and system profiles took xx ms.“, the remote can not work.

roblourens commented 2 years ago

But it did work when not using the theme? Whenever I start powershell I get

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\roblou>
Jack-Works commented 2 years ago

But it did work when not using the theme? Whenever I start powershell I get

Ah, I'm using pwsh as my default SSH shell. So the output is Powershell instead of Windows Powershell

Jack-Works commented 2 years ago

@QuYue hi please don't close this because others are still having this problem. you can unsubscribe from this issue if you're not interested anymore.

QuYue commented 2 years ago

Oh, so sorry. I misoperated.

Hercier commented 1 year ago

I have had this problem too, but the remote could work sometimes.