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
compilerPath setting of c_cpp_properties.json no longer supports batch files #3428
compilerPath setting of c_cpp_properties.json no longer supports batch files (.bat). Earlier versions did support these. Using "cmd /C call xx.bat" works, however it is not possible to pass "${workspaceFolder}" as an argument.
Using a batch file results in the misleading error:
Failed to spawn process. Error: 2 (The system cannot find the file specified.)
To Reproduce
Use a c_cpp_properties.json file with a setting of:
Either the batch file can be launched directly, or at least make it possible to pass the 'workspaceFolder' as an argument to cmd to launch a batch file.
Additional context
The reason I wish to launch a batch file from the workspace folder is I want to have a 'dummy compiler' included as part of the project. This dummy compiler just returns the include paths and defines etc as gcc/g++ would. I use this technique for remote development from windows to linux with 'correct' intellisense.
However recent versions of vscode/cpptools have blocked this ability.
Sorry about that -- we had a bunch of bugs in this scenario. It should be fixed for our next release, but it probably won't make the soon to be released 0.22.2-insiders.
We fixed it so that .cmd/.bat files works in the command line, as well as cmd.exe with args that are paths surrounded by quotes (which was also buggy, which I assume is why your cmd.exe workaround didn't work).
We didn't fix the ${workspaceFolder} issue, i.e. we only resolve that variable when it's at the start of the compilerPath and not as an argument. If that will still be an issue for you, can you file a new bug for that?
Yeah, using cmd should work as a workaround for now, assuming there are no spaces or double quotes (bug fix pending) or ${workspaceFolder} in your path (no bug fix pending currently, semi "by design")
While I don't specifically need multiple substitution of ${workspaceFolder} - I did read a similar request on another issue. I am adding the link here for prosperity:
Thanks for letting me know about that other user's report -- the restriction on ${workspaceFolder} to be only be resolved at the beginning was an oversight that was trivial to fix as well (#3440 ).
The .bat file should work on 0.23.0-insiders now, but we didn't check in the fix for ${workspaceFolder} in the compilerPath yet (should be in 0.23.1-insiders).
Activity
sean-mcmanus commentedon Apr 8, 2019
Sorry about that -- we had a bunch of bugs in this scenario. It should be fixed for our next release, but it probably won't make the soon to be released 0.22.2-insiders.
smhc commentedon Apr 8, 2019
Could you elaborate on which fix was implemented:
Cheers.
sean-mcmanus commentedon Apr 9, 2019
We fixed it so that .cmd/.bat files works in the command line, as well as cmd.exe with args that are paths surrounded by quotes (which was also buggy, which I assume is why your cmd.exe workaround didn't work).
We didn't fix the
${workspaceFolder}issue, i.e. we only resolve that variable when it's at the start of the compilerPath and not as an argument. If that will still be an issue for you, can you file a new bug for that?smhc commentedon Apr 9, 2019
Ok thanks.
The 'cmd /C call' workaround did work ok, It's just that I couldn't use the workspaceFolder as part of the args. e.g
But being able to run a batch file directly is sufficient. Using:
Once can simply use the CWD within the batch file to use it how you like. Thanks.
sean-mcmanus commentedon Apr 9, 2019
Yeah, using cmd should work as a workaround for now, assuming there are no spaces or double quotes (bug fix pending) or
${workspaceFolder}in your path (no bug fix pending currently, semi "by design")smhc commentedon Apr 9, 2019
While I don't specifically need multiple substitution of ${workspaceFolder} - I did read a similar request on another issue. I am adding the link here for prosperity:
#1982 (comment)
I imagine the ability to invoke a batch file and use CWD would be a workaround for most scenarios.
sean-mcmanus commentedon Apr 9, 2019
Thanks for letting me know about that other user's report -- the restriction on
${workspaceFolder}to be only be resolved at the beginning was an oversight that was trivial to fix as well (#3440 ).sean-mcmanus commentedon Apr 24, 2019
The .bat file should work on 0.23.0-insiders now, but we didn't check in the fix for ${workspaceFolder} in the compilerPath yet (should be in 0.23.1-insiders).