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:
14
tui/app.py
14
tui/app.py
@@ -58,5 +58,19 @@ class GnizaApp(App):
|
|||||||
self.notify(f"{job.label} failed (exit code {message.return_code})", severity="error")
|
self.notify(f"{job.label} failed (exit code {message.return_code})", severity="error")
|
||||||
|
|
||||||
async def action_quit(self) -> None:
|
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()
|
job_manager.kill_running()
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|||||||
Reference in New Issue
Block a user