Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between process and shell in vscode tasks.json

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 or process. If shell is specified, the command is interpreted as a shell command (for example: bash, cmd, or PowerShell). If process 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?

like image 352
Will Huang Avatar asked Jan 22 '19 11:01

Will Huang


People also ask

How do I run a shell script in Visual Studio Code?

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.

Where is C_cpp_properties JSON file?

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.

What is ${ workspaceFolder?

${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.


2 Answers

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.

like image 113
Will Huang Avatar answered Sep 23 '22 18:09

Will Huang


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".

like image 44
Zifan Ma Avatar answered Sep 24 '22 18:09

Zifan Ma