'Using zsh when run task in vscode

What I want to achieve is using zsh in "output" pane whenever I run a Task in VSCode, but it keep using /bin/sh instead. The "Terminal" pane is using zsh correctly though.

Here's my configurations:

➜  ~ echo $SHELL
/bin/zsh
➜  ~ which zsh
/bin/zsh

tasks.json

{
  "version": "0.1.0",
  "command": "echo Im $0",
  "suppressTaskName": true,
  "isShellCommand": {
    "executable": "/bin/zsh"
  },
  "showOutput": "always",
  "tasks": [
    {
      "taskName": "Test",
      "args": ["test"]
    }
  ]
}

And the output when I run the Task is: Im /bin/sh



Solution 1:[1]

You could change the settings from menu File -> Preferences -> Settings. Then put the options to use zsh shell.

... another lines
... another lines
"terminal.integrated.shell.linux": "zsh"

Screenshot from my experience

Solution 2:[2]

The recommended way to do this now is the following:

"terminal.integrated.profiles.linux": {
    "zsh": {
      "path": "zsh",
      "args": []
    }
  },
"terminal.integrated.defaultProfile.linux": "zsh"

As the other answer presents the deprecated way to do it.

Note that you can customize this profile with arguments if need be :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aditya Kresna Permana
Solution 2 Peter Csala