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:
@@ -295,6 +295,20 @@ func (m BackupExecutionModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
return m, nil
|
||||
|
||||
case tea.InterruptMsg:
|
||||
// Handle Ctrl+C signal (SIGINT) - Bubbletea v1.3+ sends this instead of KeyMsg for ctrl+c
|
||||
if !m.done && !m.cancelling {
|
||||
m.cancelling = true
|
||||
m.status = "[STOP] Cancelling backup... (please wait)"
|
||||
if m.cancel != nil {
|
||||
m.cancel()
|
||||
}
|
||||
return m, nil
|
||||
} else if m.done {
|
||||
return m.parent, tea.Quit
|
||||
}
|
||||
return m, nil
|
||||
|
||||
case tea.KeyMsg:
|
||||
switch msg.String() {
|
||||
case "ctrl+c", "esc":
|
||||
|
||||
Reference in New Issue
Block a user