The Custom tasks section of the Tasks in Visual Studio Code describe the task's properties. There is a type
property that define task's type:
type: The task's type. For a custom task, this can either be
shell
orprocess
. Ifshell
is specified, the command is interpreted as a shell command (for example: bash, cmd, or PowerShell). Ifprocess
is specified, the command is interpreted as a process to execute.
I couldn't understand what's the different between them. No matter I choose shell
or process
, all the execute results are all the same.
So what's the different between interpreted as a shell command and command is interpreted as a process to execute really mean?
Open Visual Studio Code and press and hold Ctrl + ` to open the terminal. Open the command palette using Ctrl + Shift + P . Type - Select Default Shell . Select WSL Bash (NOT Git Bash ) from the options.
The c_cpp_properties. json is a file specific to the Microsoft C/C++ extension and usually exists only in the workspace folder. This file is generated (copied from a template within the extension directory itself) by the ESP-IDF extension when you create a project with the New Project Wizard or Show Examples UI.
${workspaceFolder} - the path of the folder opened in VS Code. ${workspaceFolderBasename} - the name of the folder opened in VS Code without any slashes (/) ${file} - the current opened file. ${fileWorkspaceFolder} - the current opened file's workspace folder.
The shell commands can only run inside a shell such as DIR
for cmd
and if
for bash
. So when you want to run shell commands, you have to use "type": "shell"
setting to run it correctly. When you want to just run a program such as .bat
, .sh
or .exe
, then you can just use "type": "process"
setting.
well, I recently troubled by a problem, and I finally done it by changing the type from "process" to "shell" and I think this might help you: I'm trying to run more than one .cpp files, and I used a wildcard in the args:"${fileDirname}/.cpp". When the type was process, I cannot run the project successfully, as it always tell me: "*.cpp":no such file or directory and when I change to "shell" it goes well. This might be one of the differences between "process" and "shell".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With