Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code opens a new debug console every time I build/run

Every time I build or run a program in VSCode a new python debug console is loaded. Before I know it I have 20+ and need to start deleting them. After 32 open consoles I get the error "The terminal process terminated with exit code: 256". I changed the terminal from the default console to git bash recently. How can I stop this?

enter image description here

like image 939
Connor Mote Avatar asked Dec 29 '18 23:12

Connor Mote


People also ask

How do I disable Debug console in VS Code?

VS Code maintains a debug session while the program is running, and pressing the Stop button terminates the program.

What is launch json VS Code?

A launch. json file is used to configure the debugger in Visual Studio Code. Visual Studio Code generates a launch. json (under a . vscode folder in your project) with almost all of the required information.

How do you run in debug mode in Visual Studio Code?

Switch to the Run and Debug view (Ctrl+Shift+D) and select the create a launch. json file link. VS Code will let you select an "debugger" in order to create a default launch configuration. Pick "Mock Debug".

What is breakpoint in VS Code?

Breakpoints are one of the most important debugging techniques in your developer's toolbox. You set breakpoints wherever you want to pause debugger execution. For example, you may want to see the state of code variables or look at the call stack at a certain breakpoint.


1 Answers

A way around this issue is to stop VS Code from redundantly printing to the TERMINAL during debugging in the first place. Since it prints to the DEBUG CONSOLE as well, you can use that instead.

Change console to "none" "internalConsole" in each configuration in your project's launch.json file:

"configurations": [
    {
        "name": "Python: Current File",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "internalConsole"
    }
]

May 2019 Update: the "none" option was replaced by "internalConsole" so I edited my answer to reflect that. Here's the relevant GitHub Issue.

like image 71
MarredCheese Avatar answered Sep 20 '22 08:09

MarredCheese