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
"Run VS Code outside the Developer Command Prompt" instructions fail if opened file's basename and/or dirname contains space characters #158615
Comments
@alexr00 has this ever been supported? |
@meganrogge We try to handle escaping/quoting well, but it's been a losing battle to do it correctly on every platfom+shell combination. the @casadan does it work if you try one of the other shell quoting options? Ex:
|
@alexr00
This time the Developer Command Prompt for Visual Studio is successfully run but then the compiler fails due to the unescaped space characters in
Again, removing the space character from the file name (e.g.
Switching the
Adding escaped double quotes to the
Results in:
|
I solved this problem by using the pwsh.exe terminal, which may be because the cmd.exe terminal is too old There are several key points that may need attention:
Below is my tasks.json {
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe 生成活动文件",
"command": "G:\\msys64\\ucrt64\\bin\\gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "G:\\msys64\\ucrt64\\bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": false
},
"detail": "调试器生成的任务。"
},
{
"type": "shell",
"label": "msvc cl.exe 生成活动文件",
"command": "cl.exe",
"args": [
"/source-charset:utf-8",
"/execution-charset:gbk",
"/Zi",
"/EHsc",
"/nologo",
"/Fe${fileDirname}\\${fileBasenameNoExtension}.exe",
"${file}",
"User32.Lib"
],
"options": {
"cwd": "${fileDirname}",
"shell": {
"executable": "pwsh.exe",
"args": [
"-c",
"msvc",/*msvc is soft link*/
"&&"
],
}
},
"problemMatcher": [
"$msCompile"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": false
}
}
],
"version": "2.0.0"
} |
This is actually a reproduction of issue #135994 which was closed due to insufficient information to consistently recreate it. Hopefully, this new report will shed more light on the problem.
Steps to Reproduce
tasks.json
configuration for running VS Code outside the Developer Command Prompt for Visual Studio.Expected Result
The integrated shell opens and the build is successfully completed, e.g. building
c:\Test\test.c
results in this terminal output:Actual Result
The terminal process terminates with exit code 1, apparently because the double quotes enclosing the second shell argument string in
tasks.json
are being internally dropped, thus attempting to buildc:\Test\test file.c
yields:Additional Info
For reference, here is what my
tasks.json
file looks like:Current Workarounds
Remove any space characters present in the opened file's basename and/or dirname.
If spaces must be retained, delete the escaped double quotes in line 10 of
tasks.json
and then use the caret (^
) to escape all the space characters along with any parentheses, if present. Example:Before:
After:
Does this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered: