feat: confirm before quitting when a long scan would be lost#593
Merged
Conversation
Pressing q/Q used to quit gdu immediately, so an accidental key press
could discard the results of a scan that took a long time. Now, when a
scan took longer than a few seconds and there are results on screen,
quitting shows a confirmation dialog ("no" / "yes" / "don't ask me
again"), reusing the existing deletion-confirmation modal pattern.
The behaviour is enabled by default and can be turned off with the
--no-confirm-quit flag or no-confirm-quit: true in the config file.
Also guards handleQuit against re-triggering while a confirm dialog is
open, which additionally prevents q from quitting the app while the
delete-confirmation dialog is shown.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The previous change only recorded the scan duration after a scan finished, so pressing q during a still-running scan would quit immediately - losing exactly the long scan it was meant to protect. Track the scan start time and the in-progress state, and treat a scan that has been running longer than the threshold the same as a finished long scan: quitting asks for confirmation first. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #593 +/- ##
==========================================
- Coverage 85.66% 85.53% -0.14%
==========================================
Files 55 55
Lines 6029 6085 +56
==========================================
+ Hits 5165 5205 +40
- Misses 664 676 +12
- Partials 200 204 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dundee
approved these changes
Jun 23, 2026
Owner
|
Nice improvement, thank you! |
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.
Problem
In the interactive TUI,
q/Qquit immediately. It is an easy key to hit byaccident, and doing so throws away the results of a scan that may have taken a
long time — with no way to get them back without re-scanning.
Change
When quitting would discard the work of a scan that took a noticeable amount of
time (default > 3s, whether the scan is still running or already finished),
q/Qnow shows a confirmation dialog before exiting:no/yes/don't ask me again, reusing the existingdeletion-confirmation modal.
nois the default focus, consistent with fix: make 'no' the default button in delete/empty confirmation dialogs #437.--no-confirm-quitorno-confirm-quit: truein the config file.
It also guards
handleQuitagainst re-triggering while a confirmation dialog isalready open, which additionally prevents
qfrom quitting the app while thedelete-confirmation dialog is shown.
Ctrl+C/SIGTERMstill exit immediately, so there is always an escape hatch.Notes
not change scan-stopping, it only guards the accidental-exit case.
scan, confirm during a long-running scan, disabled via flag, and no
re-trigger while the dialog is open.