Integrated Console - Write-Progress messes things up
See original GitHub issueIssue Description
Running a script with Write-Progress
screws up the console.
Example Script
function MyAwesomeScript {
[CmdletBinding()]
param (
[Parameter()]
[string]
$Name
)
$WelcomeMessage = @();
for ($i = 0; $i -lt 50; $i++) {
Write-Progress -Activity "Getting ready to greet you!" -PercentComplete ($i/50*100)
$WelcomeMessage += "Hello $Name"
}
$WelcomeMessage
}
MyAwesomeScript -Name Micah
Expected Behaviour
Should look like this (example taken from pwsh running in VSCode):
Actual Behaviour
Looks like this:
The prompt is getting rendered towards the top instead of at the end of the content
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Console output overhead: why is writing to stdout so slow?
In this case, tqdm will output progress asynchronously according to the Notebook API. tqdm outputting inside Jupyter Notebook / VS Code Python ...
Read more >Write-Progress (Microsoft.PowerShell.Utility) - Microsoft Learn
The Write-Progress cmdlet displays a progress bar in a PowerShell command window that depicts the status of a running command or script.
Read more >How to make a progress bar in C# Console - YouTube
In this video, I will show you how to make a progress bar in C# Console.+Need an Authenticator!?+Site: https://keyauth.com Github: ...
Read more >c# - Console messages appearing in incorrect order when ...
Console output messages appear in an incorrect folder when they are populated by IProgress. var recounter = new IdRecounter(filePath, new ...
Read more >Your Guide to the Python print() Function
Note: str() is a global built-in function that converts an object into its string representation. You can call it directly on any object,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A couple of things missing from the old host implementation:
https://github.com/PowerShell/PowerShellEditorServices/blob/6b1e77d6223ff61c4af3cbeedf687e1f65f3ac18/src/PowerShellEditorServices/Services/PowerShellContext/Session/Host/EditorServicesPSHostUserInterface.cs#L609-L622
Track current progress messages so they can be cleared up when a the top level pipeline completes. Also a little bit under that it’s hooking into an execution status event to call
ClearProgress
after pipeline completion.Since it’s not very obvious why you’d need to do that, I’ll copy and paste an explanation from when I was suggesting it as the fix:
(it does)