PowerShell / PowerShell/vscode-powershell

Terminating a running script with Ctrl + C does not stop the debugger when using createTemporaryIntegratedConsole

Aperta
#4,927 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Area-Debugging Issue-Bug Issue-Discussion
Lingua principale
TypeScript
Stelle
1.9k
Fork
548
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.
Summary

When using the powershell.debugging.createTemporaryIntegratedConsole setting, if you use Ctrl+C to cancel a running script the PowerShell debugger does not stop; it stays running until you manually stop it. This also prevents you from rerunning the script until you manually stop the debugger.

This is the same as issue #3700 that was fixed, except it still occurs when the createTemporaryIntegratedConsole setting is enabled.

PowerShell Version
Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Name             : Visual Studio Code Host
Version          : 2024.0.0
InstanceId       : 7764663a-9b11-478d-90a6-4afd3d3fd09e
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
Visual Studio Code Version
1.86.2
903b1e9d8990623e3d7da1df3d33db3e42d80eda
x64
Extension Version
ms-vscode.powershell@2024.0.0
Steps to Reproduce
  1. Ensure the powershell.debugging.createTemporaryIntegratedConsole settings is enabled.
  2. Run a PowerShell script. e.g.
    for ($i = 0; $i -lt 10; $i++) {
    Write-Host "Running script. Press Ctrl+C to cancel script. $i"
    Start-Sleep -Seconds 1
    }
    
  3. Press Ctrl + C to cancel the script.
  4. Notice that the script stopped running, but the PowerShell debugger is still running and must be manually stopped.
Visuals

Here is a gif showing the problem. You can see that the powershell.debugging.createTemporaryIntegratedConsole setting is enabled and that a temporary terminal is created after pressing F5 to start the script. After pressing Ctrl+C to stop the script, the debugger stays running until I manually click the stop button on the debugger toolbar.

VS Code debugger stays running after script is cancelled

Logs

No response

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia cercando powershell.debugging.createTemporaryIntegratedConsole e seguendo il percorso di annullamento di Ctrl+C, quindi confrontalo con la correzione del problema #3700. Riproduci i passaggi con il ciclo fornito e verifica che l'annullamento arresti sia lo script sia il debugger, consentendo di eseguire nuovamente lo script senza arrestare manualmente il debugging.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
powershell, typescript
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.