Getting a external terminal to remain in VSCode


Hello. I’ve managed to get rust to work in VSCode,with syntax highlighting and debugging via the RLS and the Rust extension. However,I made a basic hello world program,and when I debug it and it opens a external terminal to display the output,the external terminal is only open for about .5 seconds before it closes itself. Is there a way to keep the external terminal open?

Here’s my launch.json

"version": "0.2.0",
"configurations": [
        "name": "(Windows) Launch",
        "type": "cppvsdbg",
        "request": "launch",
        "program": "${workspaceRoot}/target/debug/hello_world.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceRoot}",
        "environment": [],
        "externalConsole": true

I’d recommend using the integrated terminal in vscode to run your rust programs, but in the case you wanted to use the external console, the following can work:

use std::io::stdin;
fn end() {
    println!("Press enter to continue");
    stdin().read_line(&mut String::new());
fn main() {
    //Your code

Thanks for your fix. However,how would I use the integrated terminal,as that would seem to be a better solution.


I believe you’d need to take away this line:

"externalConsole": true

from your config and remove the trailing comma.
Note that the integrated terminal is different than the debug output terminal (Which is what this would use).


It showed the output in the debug terminal. Thank you.

1 Like