Walter
Walter

Reputation: 181

Integrated terminal setup for msys mingw not working for build task

I have managed to get the integrated terminal working with msys (bash) terminal using the following settings:

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

And this works well. I had to add the env "HOME" entry to get the sh to start in the correct home directory as it wouldn't work with (or with nothing at all):

"terminal.integrated.cwd": "${workspaceFolder}"

Now I have run into another problem. While the above settings work perfectly for a terminal window they fail for the build task. So I am forced to manually "make" from the integrated terminal window.

It fails with with error:

/d: /d: is a directory

My environment is Windows 10 msys64 mingw64.

Any ideas appreciated!

Upvotes: 2

Views: 886

Answers (1)

Matthew Jannings
Matthew Jannings

Reputation: 26

I ran into the same issue today. On their help page for tasks.json they talk about the options fields in the settings.

VSCode uses the default shell for tasks unless you tell it not to. Additionally you'll have to pass your command to the resulting shell. I solved that using -shell bash -c so bash runs the command immediately.

The syntax is something like this:

"command": "make -j8",
"options": {
  "shell": {
    "executable": "C:\\msys2\\msys2_shell.cmd",
    "args": ["-defterm", "-mingw64", "-no-start", "-here", "-shell bash -c"]
  }
}

Upvotes: 1

Related Questions