How to get rid of “Terminal will be reused by tasks, press any key to close it.” behaviour?

Check if the new feature from VSCode 1.57 (May 2021, 2.5 years after the OP) could help:

Automatically close task terminals

The task presentation property has a new close property.
Setting close to true will cause the terminal to close when the task exits.

{
  "type": "shell",
  "command": "node build/lib/preLaunch.js",
  "label": "Ensure Prelaunch Dependencies",
  "presentation": {
      "reveal": "silent",
      "revealProblems": "onProblem",
      "close": true
  }
}

[EDIT: 18-08-2018] Making it switch into the Problems tab is better when using the close option as that ensures the task terminal is closed, but the problems are properly highlighted. This is from VSCode 1.59.0.


Danin adds in the comments:

After fiddling around, I found an easy way to do it in-app;
Terminal > Configure Tasks > (select your desired task) > add "presentation": { .. } block to level containing matching "task:" entry.

Danin also mentions:

I also omitted the "reveal" entry because I prefer to see the terminal briefly — it just interferes with workflows to have it stick around.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)