Skip to content

WritePrintToken: replace WriteToConsole to avoid progress bar show during Read-Host AsSecureString#27643

Open
jserygit wants to merge 2 commits into
PowerShell:masterfrom
jserygit:fix-write-progress-reappear-secure-string-prompt
Open

WritePrintToken: replace WriteToConsole to avoid progress bar show during Read-Host AsSecureString#27643
jserygit wants to merge 2 commits into
PowerShell:masterfrom
jserygit:fix-write-progress-reappear-secure-string-prompt

Conversation

@jserygit

@jserygit jserygit commented Jun 30, 2026

Copy link
Copy Markdown

PR Summary

PR Context

When reading input with -AsSecureString, the console reads input one character at a time. After each key press, WritePrintToken() prints a "*" masking character, which eventually calls PostWrite(). Since PostWrite() shows the progress panel, the progress panel is repeatedly redisplayed while the user types.

This change replaces the direct call to WriteToConsole() with ConsoleOutWriteHelper(), matching the standard console output path. Additionally, when the interactive test tool is listening and console output is redirected, the masking character is written a second time to preserve the expected output behavior for tests.

As a result, secure input now follows the same output pipeline as other console writes while maintaining compatibility with the interactive test infrastructure.

Fix #26843

PR Checklist

@jserygit jserygit requested a review from a team as a code owner June 30, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Write-Progress bug when using ForEach-Object -Parallel and Read-Host -AsSecureString later

1 participant