You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extension should be aware of what shell type user is using to send shell specific escaped commands #24126
This issue is analogous to #23135 (which I believe was closed prematurely), specific to non-Windows environments using a shell such as sh, bash etc. I am reporting it on behalf of another confused user who actually has VS Code installed (see https://stackoverflow.com/staging-ground/78990765 for details); because I don't, I can't use the in-program process to file a bug report. But this could also be considered as a feature request, I suppose.
Steps to reproduce:
Have a username with !, $ or other specially interpreted character in it, on a Linux or Mac system.
Use a traditional shell.
Attempt to run any Python code whatsoever via the extension.
Expected result:
When a command is generated to run the Python interpreter, it should give the properly escaped path to the file being run in single quotes, so that the shell will interpret it literally. Alternately, it could avoid the problem that the quoting is trying to solve - ensuring that the file path is treated as a single token - by backslash-escaping any spaces instead.
In #23135, the same issue was reported with $ characters in PowerShell, because that shell treats them similarly.
In general, the extension needs to be aware of what shell it's using, and apply appropriate corresponding rules for quoting or escaping. It seems that currently the rule is something like "wrap in double quotes if the path contains a space", which only works for cmd (and even then I'm not 100% sure).
Thanks for this, this is great point. This is actually on the plan and we would actually be able to do this via microsoft/vscode#230165 is resolved. Lets track it: microsoft/vscode#230165
Going to leave this open so you can verify once extensions have access to shell type and we are able to use the info to properly escape in shell specific way.
changed the title [-]Incorrect quoting for file names causes terminal commands to fail (in varying platform-specific ways)[/-][+]Extension should be aware of what shell type user is using to send shell specific escaped commands[/+]on Dec 9, 2024
Activity
anthonykim1 commentedon Dec 9, 2024
Thanks for this, this is great point. This is actually on the plan and we would actually be able to do this via microsoft/vscode#230165 is resolved. Lets track it: microsoft/vscode#230165
Going to leave this open so you can verify once extensions have access to shell type and we are able to use the info to properly escape in shell specific way.
[-]Incorrect quoting for file names causes terminal commands to fail (in varying platform-specific ways)[/-][+]Extension should be aware of what shell type user is using to send shell specific escaped commands[/+]