在 VSCode 中运行任务时使用 zsh

6
我想要实现的是在我运行VSCode的任务时,“输出”窗格中使用zsh,但它一直使用/bin/sh。然而,“终端”窗格正确地使用了zsh。
以下是我的配置:
➜  ~ 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"]
    }
  ]
}

当我运行任务时的输出如下: Im /bin/sh
2个回答

5

现在建议的做法如下:

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

作为其他答案介绍的已弃用方法的补充,注意您可以根据需要使用参数自定义此配置文件。

4
你可以从菜单 文件 -> 首选项 -> 设置 中更改设置。然后将选项设置为使用 zsh shell。
... another lines
... another lines
"terminal.integrated.shell.linux": "zsh"

Screenshot from my experience


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接