Skip to content

Preserve SIGINT handler after external paging - #725

Open
hugosmoreira wants to merge 1 commit into
google:masterfrom
hugosmoreira:fix/723-restore-pager-sigint
Open

hugosmoreira wants to merge 1 commit into
google:masterfrom
hugosmoreira:fix/723-restore-pager-sigint

Conversation

@hugosmoreira

Copy link
Copy Markdown

Fixes #723.

More() temporarily ignores SIGINT while an external pager runs, but currently resets it to SIG_DFL afterward and leaves it ignored if paging raises. Save the previous handler and restore it in finally, preserving the original exception.

Add regression tests for custom/default/ignored handlers, explicit and discovered pagers, startup/encoding/communication/wait failures, and the Display() caller. Noninteractive output and internal-pager routes have compatibility controls.

Validation:

  • Six new test methods pass on Windows Python 3.13 and Linux Python 3.7, 3.12 and 3.14. The pre-fix run and negative controls produce 16 failed assertions.
  • Linux Python 3.12: 279 tests pass both without and with IPython.
  • Windows Python 3.13: 271 pass and eight fail in both variants; the same eight failures occur on unchanged master.
  • CI lint, new-test lint, wheel/sdist builds and built-wheel regression tests pass on Windows and Linux. Broader lint findings and the Linux 3.12 type-check failures match unchanged master.
  • Linux 3.7/3.14 integration checks run a real cat pager and deliver SIGINT afterward; the custom callback is retained. Unchanged master loses it.

macOS and the remaining hosted matrix were not run. Interactive detection is controlled in the pager checks; no manual terminal session is claimed.

#666 overlaps exception cleanup but still restores SIG_DFL. This change preserves the previous handler without changing command parsing or fallback behavior.

This branch has not been deployed

No deployments
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.

External pager resets custom SIGINT handlers to SIG_DFL

1 participant