1

我已经设法使用以下设置使集成终端与 msys (bash) 终端一起工作:

"terminal.integrated.shell.windows": "C:\\msys64\\bin\\msys_shell.cmd",
"terminal.integrated.shellargs.windows": "-mingw64 -defterm -nostart",
"terminal.integrated.env.windows": "HOME": "${workspace Folder}"

这很好用。我必须添加 env "HOME" 条目以使 sh 在正确的主目录中启动,因为它无法使用(或根本没有):

“terminal.integrated.cwd”:“${workspaceFolder}”

现在我遇到了另一个问题。虽然上述设置非常适合终端窗口,但它们在构建任务中失败。所以我被迫从集成终端窗口手动“制作”。

它失败并出现错误:

/d: /d: 是一个目录

我的环境是 Windows 10 msys64 mingw64。

任何想法表示赞赏!

4

1 回答 1

0

我今天遇到了同样的问题。在他们的 tasks.json帮助页面上,他们讨论了设置中的选项字段。

VSCode 使用默认的 shell 来执行任务,除非你告诉它不要这样做。此外,您必须将命令传递给生成的 shell。我解决了使用-shell bash -c所以 bash 立即运行命令的问题。

语法是这样的:

"command": "make -j8",
"options": {
  "shell": {
    "executable": "C:\\msys2\\msys2_shell.cmd",
    "args": ["-defterm", "-mingw64", "-no-start", "-here", "-shell bash -c"]
  }
}
于 2018-11-26T19:21:55.400 回答