I think the difference is as follows:
process
: runs a specific program (a binary)
shell
: starts a shell session and runs the given command inside of that shell session
If the command you give to a shell is just (the path to) a program, for example date
, the result will be exactly the same.
{
"version": "2.0.0",
"tasks": [
{
"label": "example1",
"type": "process",
"command": "date",
"presentation": {
"reveal": "always"
},
"problemMatcher": []
},
{
"label": "example2",
"type": "shell",
"command": "date",
"presentation": {
"reveal": "always"
},
"problemMatcher": []
}
]
}
The task that uses process
will probably be a little faster because it does not start a shell session.
But because a shell
type task creates a shell session it can use any command you can type on the command line. So let's say the task we want to run is date -u +"%Y-%m-%dT%H:%M:%SZ"
, we can do this with a shell
task, but not with a process
task.
Example:
{
"version": "2.0.0",
"tasks": [
{
"label": "example1",
"type": "process",
"command": "date",
"presentation": {
"reveal": "always"
},
"problemMatcher": []
},
{
"label": "example2",
"type": "shell",
"command": "date -u +\"%Y-%m-%dT%H:%M:%SZ\"",
"presentation": {
"reveal": "always"
},
"problemMatcher": []
}
]
}
So, as always, it depends on what you need or want. Personally I think tasks of type shell
are useful way more often.
One extra thing: a task definition can also have a "args"
key where you can send arguments. That may allow you to send arguments if you need to use process. I did not investigate that to answer this question.
Another relevant page of docs.