Repository navigation
fix(installer): Ctrl-C at a menu exits under macOS bash 3.2 - #77
Merged
Merged
Conversation
bash 3.2 (macOS /bin/bash) restarts a read that a trapped SIGINT interrupts and runs the trap only after the read returns. Ctrl-C at an arrow-key menu therefore waited for another key instead of exiting 130, which made test_interrupt_at_a_prompt_restores_the_terminal flaky on the macOS zsh runner (1 pass in 6 locally with /bin/bash). The menu now reads each key with a one-second timeout in a loop, so the INT trap runs between reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review on ArchCode
Problem and author intent
test_interrupt_at_a_prompt_restores_the_terminalinscripts/test-installer-prompts.pyis the only failing job in this repo's last six failed Installer Smoke Test runs: three onmain(10-19 19:41Z, 10-20 02:24Z, 15:36Z) and three on PR branches, always Unix Installer (macos-latest, zsh) with "installer did not exit".It is a real installer bug, not just a bad test:
Whether the test hangs depends on whether Ctrl-C lands during
reador during the menu redraw. Locally on macOS with/bin/bash3.2 it failed 5 runs out of 6.What changed
install.sh: aread_keyhelper reads one key with a one-second timeout in a loop. On a timeout (status > 128) it reads again, which gives bash 3.2 a point to run the INT trap. End of input still reads as Enter, as before. The arrow-key menu uses it; the escape-sequenceread -rsn2 -t 1already had a timeout.Unchanged: the plain-terminal numbered prompt (
TERM=dumb) still uses a linereadwith the same latent behavior. No test covers it, and a timeout on a line read risks dropping partly typed input, so it is left for a follow-up.Risk
Low. One prompt-input helper. Keys, arrows, digits and Enter behave the same; the only difference is that an idle menu wakes once a second.
Testing
scripts/test-installer-prompts.py(the test that CI runs on every installer platform):test_interrupt_at_a_prompt_restores_the_terminalwith macOS/bin/bash3.2: 10/10, up from 1/6 before the fix;🤖 Generated with Claude Code