Second Write-Progress not displayed unless there is a delay #25746
Replies: 1 comment
|
You're right that this is PS 7-specific behavior. The progress renderer was reworked in PowerShell 7.2 — progress output now renders through PSReadLine and the renderer coalesces/throttles repaints instead of redrawing on every record. When you mark a bar The cleanest workaround is to use a distinct Write-Progress -Activity "Testing1" -Id 1
Start-Sleep 5
Write-Progress -Activity "Testing1" -Completed -Id 1
Start-Sleep 5
Write-Progress -Activity "Testing2" -Id 2 # new Id -> always repaints
Start-Sleep 5
Write-Progress -Activity "Testing2" -Completed -Id 2A few related notes:
This is worth reporting as a bug if you'd like it fixed — the repro is minimal and it's a clear regression vs. 5.1. In the meantime, unique |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Starting this as a discussion in case I'm missing something (i.e. before reporting as issue). Consider this code which displays two progress bars one after the other. If you comment out the highlighted line, the second progress bar isn't displayed. Works as expected on PowerShell v5. Looks like some timing issue?
NOTE: if you miss the completed line out, the 2nd progress bar is display without the delay. It's the action of completing it that appears to be the problem.
All reactions