Skip to content

fix ctrl-c prompt during run migrations prompt - #10947

Merged
gammazero merged 3 commits into
masterfrom
fix-ctrl-c-prompt-with-migrations
Sep 4, 2025
Merged

gammazero merged 3 commits into
masterfrom
fix-ctrl-c-prompt-with-migrations

Conversation

@gammazero

@gammazero gammazero commented Aug 30, 2025 •

Copy link
Copy Markdown
Contributor

At "Run migrations" prompt, hitting ctrl-c does not show the "(Hit ctrl-c again to force-shutdown the daemon.)" prompt, even though a 2nd ctrl-c does cause the daemon to exit.

The problem is that the goroutine that displays the prompt runs after the prompt for "Run migrations", so hitting ctrl-c during the "Run migrations" prompt does not show the "(Hit ctrl-c again to force-shutdown the daemon.)" prompt.

This PR fixes the problem by starting a goroutine that exits immediately if ctrl-c is detected during the the "Run migrations" prompt. There is no need to wait for a second ctrl-c because there is nothing to graecefully shutdown.

Additionally, this PR also removed the creating of an unnecessary goroutine in the shutdown handler.

Closes #3157

@gammazero
gammazero requested a review from a team as a code owner August 30, 2025 00:05
@gammazero gammazero added the skip/changelog This change does NOT require a changelog entry label Aug 30, 2025
@gammazero
gammazero marked this pull request as draft August 30, 2025 21:24
At "Run migrations" prompt, hitting ctrl-c does not show the "(Hit ctrl-c again to force-shutdown the daemon.)" prompt, even though a 2nd ctrl-c does cause the daemon to exit.

The problem is that the goroutine that displays the prompt only run after the prompt to "Run migrations", so hitting ctrl-c during the "Run migrations" prompt does not show the "(Hit ctrl-c again to force-shutdown the daemon.)" prompt.

This PR fixes the problem by starting the goroutine to display the "(Hit ctrl-c again to force-shutdown the daemon.)" prompt sooner, before the "Run mirgarions" prompt. Additionally, this PR also disables showing the ctrl-c prompt if the daemon function has already exited, in which case only the exit message should be shown.

Closes #3157
@gammazero
gammazero force-pushed the fix-ctrl-c-prompt-with-migrations branch from c8c8417 to 1c5e46f Compare August 31, 2025 05:12
@gammazero
gammazero marked this pull request as ready for review August 31, 2025 05:16
@gammazero
gammazero requested a review from lidel September 2, 2025 17:00
@gammazero
gammazero merged commit 72280f3 into master Sep 4, 2025
@gammazero
gammazero deleted the fix-ctrl-c-prompt-with-migrations branch September 4, 2025 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip/changelog This change does NOT require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrations prompt hides Ctrl+c for shutdown

1 participant