microsoft / microsoft/vscode-cpptools
Don't immediately close the external console window when the program ends
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Type: Debugger
Describe the bug
- OS and Version: Windows 10
- VS Code Version: 1.47.3
- C/C++ Extension Version: 0.29.0
- Other extensions you installed (and if the issue persists after disabling them): none
When debugging and running C/C++ code on an external console ("externalConsole": true in launch.json), the console window is immediately closed at the end of the program.
This is inconvenient, as there can be some output we are interested in and that we are unable to read as the console window is immediately closed.
There are workarounds to that, like putting a breakpoint in the last return 0; line of main(), or adding cin.ignore(); cin.get(); lines, or getch(), or system("PAUSE");, or something similar.
But these are not optimal solutions.
The best experience would be to just have the external console to prompt the user to press a key before it gets closed (like the debugger would automatically invoke a system("PAUSE") before closing the external console).
This behavior could be made customizable with something like "externalConsolePauseAtExit": true/false in launch.json.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the launch.json handling for externalConsole and the Windows debugger process-exit path. Run a minimal C/C++ program with externalConsole enabled and verify that the external window can pause before closing, with the behavior controlled by the proposed configuration option.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, typescript
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100