Skip to content

feat: confirm before quitting when a long scan would be lost#593

Merged
dundee merged 2 commits into
dundee:masterfrom
ultranity:feat/confirm-before-quit
Jun 23, 2026
Merged

feat: confirm before quitting when a long scan would be lost#593
dundee merged 2 commits into
dundee:masterfrom
ultranity:feat/confirm-before-quit

Conversation

@ultranity

@ultranity ultranity commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Problem

In the interactive TUI, q / Q quit immediately. It is an easy key to hit by
accident, 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 / Q now shows a confirmation dialog before exiting:

It also guards handleQuit against re-triggering while a confirmation dialog is
already open, which additionally prevents q from quitting the app while the
delete-confirmation dialog is shown.

Ctrl+C / SIGTERM still exit immediately, so there is always an escape hatch.

Notes

ultranity and others added 2 commits June 19, 2026 14:22
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

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.19355% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.53%. Comparing base (301ef84) to head (cbf3845).

Files with missing lines Patch % Lines
tui/keys.go 75.51% 9 Missing and 3 partials ⚠️
cmd/gdu/app/app.go 0.00% 3 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dundee dundee merged commit ee9e4e2 into dundee:master Jun 23, 2026
9 checks passed
@dundee

dundee commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Nice improvement, thank you!

@ultranity ultranity deleted the feat/confirm-before-quit branch June 27, 2026 20:06
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.

2 participants