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

state: ensure that cursor is revealed when spinner exits #281

Merged
merged 2 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ All versions prior to 0.0.9 are untracked.

## [Unreleased]

### Fixed

* CLI: A bug causing the terminal's cursor to disappear on some
versions of CPython was fixed
([#280](https://github.com/trailofbits/pip-audit/issues/280))

## [2.3.0] - 2022-05-18

### Added
Expand Down
6 changes: 6 additions & 0 deletions pip_audit/_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from logging.handlers import MemoryHandler
from typing import Any, Dict, List, Sequence

from progress import SHOW_CURSOR
from progress.spinner import Spinner as BaseSpinner


Expand Down Expand Up @@ -163,6 +164,11 @@ def finish(self) -> None:
"""
self.writeln("")
self.file.write("\r")

# `BaseSpinner` normally re-reveals the cursor as part of `finish()` or
# `__del__`, but we override `finish()` and `__del__` isn't reliably
# invoked on context exit. So we do it manually here.
self.file.write(SHOW_CURSOR)
self.file.flush()

def update_state(self, message: str) -> None:
Expand Down