fix(tui): handle tea.InterruptMsg for proper Ctrl+C cancellation
Bubbletea v1.3+ sends InterruptMsg for SIGINT signals instead of KeyMsg with 'ctrl+c', causing cancellation to not work properly. - Add tea.InterruptMsg handling to restore_exec.go - Add tea.InterruptMsg handling to backup_exec.go - Add tea.InterruptMsg handling to menu.go - Call cleanup.KillOrphanedProcesses on all interrupt paths - No zombie pg_dump/pg_restore/gzip processes left behind Fixes Ctrl+C not working during cluster restore/backup operations. v3.42.50
This commit is contained in:
@@ -188,6 +188,21 @@ func (m *MenuModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
return m, nil
|
||||
|
||||
case tea.InterruptMsg:
|
||||
// Handle Ctrl+C signal (SIGINT) - Bubbletea v1.3+ sends this
|
||||
if m.cancel != nil {
|
||||
m.cancel()
|
||||
}
|
||||
|
||||
// Clean up any orphaned processes before exit
|
||||
m.logger.Info("Cleaning up processes before exit (SIGINT)")
|
||||
if err := cleanup.KillOrphanedProcesses(m.logger); err != nil {
|
||||
m.logger.Warn("Failed to clean up all processes", "error", err)
|
||||
}
|
||||
|
||||
m.quitting = true
|
||||
return m, tea.Quit
|
||||
|
||||
case tea.KeyMsg:
|
||||
switch msg.String() {
|
||||
case "ctrl+c", "q":
|
||||
|
||||
Reference in New Issue
Block a user