Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: $host.UI.RawUI.KeyAvailable has false positives. #959

Open
mklement0 opened this issue Jul 6, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@mklement0
Copy link

commented Jul 6, 2019

Environment data

PS version: 7.0.0-preview.1
PSReadline version: 2.0.0-beta4
os: 10.0.18362.1 (WinBuild.160101.0800)
PS file version: 7.0.0.0
BufferWidth: 180
BufferHeight: 9999

Steps to reproduce or exception report

Note: The problem surfaces on Windows only.

Run the following code with and without PSReadLine imported:

# Show a spinner until the user presses a key.
$i=0; while (-not $host.UI.RawUI.KeyAvailable) { Write-Host -NoNewline ("`r{0}" -f '/―\|'[($i++ % 4)]); start-sleep -ms 200 }

Expected: A spinner should appear and keep spinning until the user presses a key.

Actual, with PSReadLine imported: The while loop is either never entered (1st invocation immediately after start of the PS session) or stops after one iteration even if no key is pressed (subsequent invocations).

Once you run Remove-Module PSReadLine, the behavior is as expected

@lzybkr lzybkr added the duplicate label Jul 6, 2019

@lzybkr

This comment has been minimized.

Copy link
Member

commented Jul 6, 2019

Duplicate of #901 and #291.

@daxian-dbw daxian-dbw added this to the 2.0.0-Consider milestone Jul 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.