Don't kill running jobs on TUI exit

Previously action_quit() killed all running jobs before exiting,
making it impossible to reconnect to them on restart. Now shows a
confirmation dialog when jobs are running and lets them continue
in the background.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shuki
2026-03-06 20:38:03 +02:00
parent 3eb6c31509
commit 0de0f7783a

View File

@@ -58,5 +58,19 @@ class GnizaApp(App):
self.notify(f"{job.label} failed (exit code {message.return_code})", severity="error")
async def action_quit(self) -> None:
if job_manager.running_count() > 0:
from tui.widgets import ConfirmDialog
self.push_screen(
ConfirmDialog(
f"{job_manager.running_count()} job(s) still running.\nQuit and let them continue in background?",
"Confirm Quit",
),
callback=lambda ok: self._do_quit(kill=False) if ok else None,
)
else:
self.exit()
def _do_quit(self, kill: bool = False) -> None:
if kill:
job_manager.kill_running()
self.exit()