Skip to content

Commit bb2ad45

Browse files
Ensure progress bar for Wait-JobWithAnimation gets marked as Completed (#169)
Per helpful feedback from @StartAutomating: "Taking a brief look at implementation, I don't see where you send -Completed message to Write-Progress. This will cause progress bars to stay visible while any other commands in the script execute. E.g. if you ran a Get- that returned many results, and piped to an expensive Foreach-Object, your progress bar wouldn't go away until the Foreach-Object ended."
1 parent 79c30d4 commit bb2ad45

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Helpers.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ function Wait-JobWithAnimation
110110
$iteration++
111111
}
112112

113+
# Ensure that we complete the progress bar once the command is done, regardless of outcome.
114+
Write-Progress -Activity $Description -Id $progressId -Completed
115+
113116
# We'll wrap the description (if provided) in brackets for display purposes.
114117
if (-not [string]::IsNullOrWhiteSpace($Description))
115118
{

0 commit comments

Comments
 (0)