vscode-code-runner
vscode-code-runner copied to clipboard
[Bug] code runner "Run in Terminal" with bad naming C++ file couldn't output right results
- VS Code Version: 1.91.1
- OS Version: Windows 11, 22631
- Code Runner Version: 0.12.2
Describe the bug When code runner setting "Run in Terminal" set to True, bad naming C++ files (4.2.3.instr2.cpp for example) couldn't output correct results in terminal.
To Reproduce Steps to reproduce the behavior:
- Set "Run in Terminal" of code-runner to "True"
- Create a C++ file with bad naming, for example "4.2.3.instr2.cpp"
- Edit the C++ file, with input and output using
coutandcin, for example:
// instr2.cpp -- reading more than one word with getline
#include <iostream>
int main()
{
using namespace std;
const int ArSize = 20;
char name[ArSize];
char dessert[ArSize];
cout << "Enter your name:\n";
cin.getline(name, ArSize);
cout << "Enter your favorite dessert:\n";
cin.getline(dessert, ArSize);
cout << "I have some delicious " << dessert;
cout << " for you, " << name << ".\n";
return 0;
}
- Run code with Ctrl+Alt+N
Actual behavior The terminal outputs:
PS G:\OneDrive\Obsidian\06-Coding\C++\cppPrimerPlus\chapter.4.compoTypes\4.3.stringClass> cd "g:\OneDrive\Obsidian\06-Coding\C++\cppPrimerPlus\chapter.4.compoTypes\4.2.strings\" ; if ($?) { g++ 4.2.3.instr2.cpp -o 4.2.3.instr2 } ; if ($?) { .\4.2.3.instr2 }
PS G:\OneDrive\Obsidian\06-Coding\C++\cppPrimerPlus\chapter.4.compoTypes\4.2.strings>
Expected behavior
PS G:\OneDrive\Obsidian\06-Coding\C++\cppPrimerPlus\chapter.4.compoTypes\4.3.stringClass> cd "g:\OneDrive\Obsidian\06-Coding\C++\cppPrimerPlus\chapter.4.compoTypes\4.2.strings\" ; if ($?) { g++ 4.2.3.instr2.cpp -o 4.2.3.instr2 } ; if ($?) { .\4.2.3.instr2 }
Enter your name:
Screenshots
Removing "." in file name (for example, change "4.2.3.instr2.cpp" to "instr2.cpp" could solve the problem.
can you show your executor map line for c++?
looks like either an issue with quoting or the .\