问题
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?
回答1:
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.
回答2:
Adding "args": ["&&", "exit"],
to launch.json
remedies this for Git Bash. Certainly a hack, but I no longer have to manually close many debug terminals.
来源:https://stackoverflow.com/questions/53974197/vs-code-opens-a-new-debug-console-every-time-i-build-run