-
Notifications
You must be signed in to change notification settings - Fork 513
F5 with script containing single quotes results in 'not recognized as a ....' error #4269
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
F5 with script containing single quotes results in 'not recognized as a ....' error #4269
Comments
You'll need to escape the single quotes. We had to switch from double to single quotes to avoid interpolating |
Err, I guess with F5 we'll need to escape the single quotes. |
@SeeminglyScience I swear we were running this through an escaper at one point? |
Ideally PowerShell would provide an argument escaper, as it has one as part of the Completer, but I am not sure it has a public interface. |
Ok so once upon a time we did run this through some amount of escaping per PowerShell/PowerShellEditorServices#1611. In fact, there's a comment that "For a saved file we just execute its path (after escaping it)." But we stopped escaping it! I think the course of action here is to continue to single-quote the file, so we don't have to escape anything except single quotes. |
Since we surround it with single quotes. Resolves PowerShell/vscode-powershell#4269 with tests.
Prerequisites
Summary
Following #4238, anytime an argument is quoted, it needs to have existing quotes escaped. On Windows, single quotes can appear in the file name/file path, but double quotes cannot, but on 'nix, both can.
I created a script with quotes in the file name (this is not at all unusual for me), added something simple to the script file, and then pressed F5 to attempt to run it, and received an error that the path was invalid.
PowerShell Version
Visual Studio Code Version
Extension Version
Steps to Reproduce
Create script with single quotes and press F5 to run.
Visuals
Logs
No response
The text was updated successfully, but these errors were encountered: