Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Regression in 7.4.2] Statement in finally block stop working when ctrl-c is pressed that stops script running in the try block #21552

Open
5 tasks done
daxian-dbw opened this issue Apr 29, 2024 · 0 comments
Assignees
Labels
7.4-regression Regression in 7.4 Needs-Triage The issue is new and needs to be triaged by a work group.

Comments

@daxian-dbw
Copy link
Member

daxian-dbw commented Apr 29, 2024

Prerequisites

Steps to reproduce

Remove-Item -ErrorAction Ignore temp:/$PID.txt
try {
  Read-Host 'Press Ctrl-C now'
}
finally {
  ## this should be put in the file
  "Hello" > temp:/$PID.txt  ## or Get-Date > temp:/$PID.txt
}

## Press ctrl+c, then run
cat temp:/$PID.txt

Expected behavior

## "Hello" should be printed, which is the behavior in 7.2, 7.4.0, and 7.4.1.
Hello

Actual behavior

This is a regression in 7.4.2

Nothing is written out. The file doesn't contain any content.

Error details

No Error.

Environment data

PS:38> $PSVersionTable

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

Visuals

No response

@daxian-dbw daxian-dbw added the Needs-Triage The issue is new and needs to be triaged by a work group. label Apr 29, 2024
@daxian-dbw daxian-dbw added the 7.4-regression Regression in 7.4 label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7.4-regression Regression in 7.4 Needs-Triage The issue is new and needs to be triaged by a work group.
Projects
None yet
Development

No branches or pull requests

2 participants