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
Prerequisites
Steps to reproduce
Expected behavior
Actual behavior
This is a regression in 7.4.2
Error details
Environment data
Visuals
No response