microsoft / microsoft/vscode-cpptools
User input when debugging C++ on MacOs
@WardenGnaw is already working on this.
Since Jun 3, 2020.
- 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:

-
VS Code Version:

-
C/C++ Extension Version: 0.28.1
-
Other extensions you installed (and if the issue persists after disabling them):

-
A clear and concise description of what the bug is.
When attempting to debug a simple C++ script that requires user input, the external console does not allow for the input to be given, instead displaying darwin-debug description (print screen in additional context.).
To Reproduce
Please include a code sample and launch.json configuration.
Code sample
#include <iostream>
using namespace std;
int main(){
string output;
cout << "Teste" << endl;
cin >> output;
cout << output << endl;
return 0;
}
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "clang++ - Criar e depurar o arquivo ativo",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "lldb",
"preLaunchTask": "clang++ build active file"
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-std=c++17",
"-stdlib=libc++",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Steps to reproduce the behavior:
- Create .vscode folder and within it setup tasks.json and launch.json.
- Create hello_world.cpp and paste the code sample.
- Select the run and debug tab.
- Click the green run icon.
Additional context
External console print screen

I have already tried using the workaround described at #https://github.com/microsoft/vscode-cpptools/issues/5079#issuecomment-626090192
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.
Assessment
This issue has not been assessed yet.