SchoofsKelvin / vscode-sshfs

Extension for Visual Studio Code: File system provider using SSH
GNU General Public License v3.0
543 stars 36 forks source link

Cannot launch a remote Windows powershell terminal #255

Open djndl1 opened 3 years ago

djndl1 commented 3 years ago

I have a Windows 2016 Server running the OpenSSH Server ported by Microsoft. vscode-sshfs connection is fine and mounting is usable but the terminal won't launch. I tried setting Terminal Command to the Windows path to PowerShell.exe but it didn't work. Is this supported or am I just doing the impossible?

SchoofsKelvin commented 3 years ago

I'll have to look a bit more into it, but currently it seems like Windows executes:

"c:\\windows\\system32\\cmd.exe" /c "cd /; powershell"

which fails because Windows command prompt doesn't accept ; as a command splitter.

I'm not sure whether changing the extension to "split" using && (which command prompt supports) instead of ; would break (some) Unix operating systems, so I'll have to look into that.

For a temporary fix, I pushed a small fix (d20d4be) that fixes this, but you have to add this flags to your config in your VS Code User Settings (settings.json):

    "sshfs.configs": [
        {
            "name": "your-server",
            "flags": ["WINDOWS_COMMAND_SEPARATOR"],
            "terminalCommand": "powershell"
        }
    ],

Mind that you also need to include the "terminalCommand": "powershell", since the extension otherwise tries to use $SHELL which apparently isn't a thing here either. The fix is available in v1.20.1 of the extension, just released.