Skip to content

Write-Progress since 7.2.0 sets CursorVisible to $true #16412

Closed

Description

@eddiezato

Prerequisites

Steps to reproduce

Run the script:

[Console]::CursorVisible = $false
Write-Host "Before wp - " -NoNewLine
[Console]::CursorVisible
0..10 | % {
    Write-Progress -Activity test -Status test -PercentComplete $_
    Start-Sleep -s 0.1
}
Write-Host "After wp - " -NoNewLine
[Console]::CursorVisible

Expected behavior

Write-Progress shouldn't affect the state of CursorVisible

Actual behavior

PS > .\script.ps1
Before wp - False
After wp - True

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.0
PSEdition                      Core
GitCommitId                    7.2.0
OS                             Microsoft Windows 10.0.22000
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Activity

  1. added
    Needs-Triage
    on Nov 9, 2021
  2. added
    Issue-Question
    WG-Engine
    on Nov 9, 2021
  3. daxian-dbw commented on Nov 10, 2021

    @daxian-dbw
    Member

    Steve Lee (@SteveL-MSFT) can you please take a look to see if this behavior is intentional?

  4. SteveL-MSFT commented on Jan 20, 2022

    @SteveL-MSFT
    Member

    I see where the cursor visibility is being changed, I'll submit a PR, should be a simple fix. Ok, hit an issue, on non-Windows, [Console]::CursorVisible is not supported. This means it can't read if the cursor is currently visible or not. So the problem is we don't want to just rely on the current cursor visibility as rendering progress would show the cursor. So think the only thing we can do is support this for Windows for now.

  5. ghost added
    In-PR
    on Jan 20, 2022
  6. removed
    Needs-Triage
    on Jan 20, 2022
  7. ghost removed
    In-PR
    on May 13, 2022
  8. ghost added
    Resolution-Fixed
    on May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-QuestionResolution-FixedWG-Engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions