Change:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Please search existing issues to avoid creating duplicates. --<!-- Also please test using the latest insiders build to make sure your issue has not already been fixed: --It's the second time it happened. First time was a fresh project so as I didn't investigate further. I thought I messed up somehow. Second time I lost some datasets and got close to lose some code. I found the culprit so I hope it won't to me a third time. <!-- Use Help Report Issue to prefill these. --Version: 1.48.2 (system setup) Electron: 7.3.2 V8: 7.8.279.23-electron.0 OS: WindowsNT x64 10.0. Steps to Reproduce: a debugging session, that open a fresh python debug console terminal debugging session terminate in python debug console terminal: pressing enter, so the command don't execute but sit there a new debugging session VS code will then reuse the 'python debug console terminal' previously open, with my un-executed command still sitting there. It do its business as usually and inputting: resulting the command: and Poof my whole project is gone <!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes/No
We should clear any input before executing a command.
I agree, I'm quite suprise it was not the case already. Waiting for the fix. There is the possibility of setting the debug console to be spawn in the debug output tab. In ’’ ’"console": "internalConsole"’
I'm now cancelling the input with Control-C. This should work on all platforms and for all shells.
Perfect, thanks for your work
The fix for this causes Reverting for the release.
Same thing happens with the C++/CMake extension when pressing F5.

Discussion:
const terminalName = args.title || nls.localize('debug.terminal.title', "Debug Process"); const termKey = createKeyForShell(shell, shellArgs, args); <del> let terminal = await this._integratedTerminalInstances.checkout(termKey, terminalName); </del> <ins> let terminal = await this._integratedTerminalInstances.checkout(termKey, terminalName, true); </ins> let cwdForPrepareCommand: string | undefined; let giveShellTimeToInitialize = false;

// give a new terminal some time to initialize the shell await new Promise(resolve => setTimeout(resolve, 1000)); } else { <ins> if (terminal.state.isInteractedWith) { terminal.sendText('u0003'); // Ctrl+C for #106743. Not part of the same command for #107969 } </ins> if (configProvider.getConfiguration('debug.terminal').get<boolean>('clearBeforeReusing')) { // clear terminal before reusing it if (shell.indexOf('powershell') >= 0 || shell.indexOf('pwsh') >= 0 || shell.indexOf('cmd.exe') >= 0) {

private _terminalInstances = new Map<vscode.Terminal, { lastUsedAt: number; config: string }>(); <del> public async checkout(config: string, name: string) { </del> <ins> public async checkout(config: string, name: string, cleanupOthersByName = false) { </ins> const entries = [...this._terminalInstances.entries()]; const promises = entries.map(([terminal, termInfo]) => createCancelablePromise(async ct => {

} if (termInfo.config !== config) { <ins> if (cleanupOthersByName) { terminal.dispose(); } </ins> return null; }