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:
15
CHANGELOG.md
15
CHANGELOG.md
@@ -5,6 +5,21 @@ All notable changes to dbbackup will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [3.42.50] - 2026-01-16 "Ctrl+C Signal Handling Fix"
|
||||||
|
|
||||||
|
### Fixed - Proper Ctrl+C/SIGINT Handling in TUI
|
||||||
|
- **Added tea.InterruptMsg handling** - Bubbletea v1.3+ sends `InterruptMsg` for SIGINT signals
|
||||||
|
instead of a `KeyMsg` with "ctrl+c", causing cancellation to not work
|
||||||
|
- **Fixed cluster restore cancellation** - Ctrl+C now properly cancels running restore operations
|
||||||
|
- **Fixed cluster backup cancellation** - Ctrl+C now properly cancels running backup operations
|
||||||
|
- **Added interrupt handling to main menu** - Proper cleanup on SIGINT from menu
|
||||||
|
- **Orphaned process cleanup** - `cleanup.KillOrphanedProcesses()` called on all interrupt paths
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- All TUI execution views now handle both `tea.KeyMsg` ("ctrl+c") and `tea.InterruptMsg`
|
||||||
|
- Context cancellation properly propagates to child processes via `exec.CommandContext`
|
||||||
|
- No zombie pg_dump/pg_restore/gzip processes left behind on cancellation
|
||||||
|
|
||||||
## [3.42.49] - 2026-01-16 "Unified Cluster Backup Progress"
|
## [3.42.49] - 2026-01-16 "Unified Cluster Backup Progress"
|
||||||
|
|
||||||
### Added - Unified Progress Display for Cluster Backup
|
### Added - Unified Progress Display for Cluster Backup
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
This directory contains pre-compiled binaries for the DB Backup Tool across multiple platforms and architectures.
|
This directory contains pre-compiled binaries for the DB Backup Tool across multiple platforms and architectures.
|
||||||
|
|
||||||
## Build Information
|
## Build Information
|
||||||
- **Version**: 3.42.48
|
- **Version**: 3.42.49
|
||||||
- **Build Time**: 2026-01-16_14:32:45_UTC
|
- **Build Time**: 2026-01-16_14:37:18_UTC
|
||||||
- **Git Commit**: 780beaa
|
- **Git Commit**: bfe99e9
|
||||||
|
|
||||||
## Recent Updates (v1.1.0)
|
## Recent Updates (v1.1.0)
|
||||||
- ✅ Fixed TUI progress display with line-by-line output
|
- ✅ Fixed TUI progress display with line-by-line output
|
||||||
|
|||||||
@@ -295,6 +295,20 @@ func (m BackupExecutionModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
}
|
}
|
||||||
return m, nil
|
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:
|
case tea.KeyMsg:
|
||||||
switch msg.String() {
|
switch msg.String() {
|
||||||
case "ctrl+c", "esc":
|
case "ctrl+c", "esc":
|
||||||
|
|||||||
@@ -188,6 +188,21 @@ func (m *MenuModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
}
|
}
|
||||||
return m, nil
|
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:
|
case tea.KeyMsg:
|
||||||
switch msg.String() {
|
switch msg.String() {
|
||||||
case "ctrl+c", "q":
|
case "ctrl+c", "q":
|
||||||
|
|||||||
@@ -536,6 +536,21 @@ func (m RestoreExecutionModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
}
|
}
|
||||||
return m, nil
|
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 restore... (please wait)"
|
||||||
|
m.phase = "Cancelling"
|
||||||
|
if m.cancel != nil {
|
||||||
|
m.cancel()
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
} else if m.done {
|
||||||
|
return m.parent, tea.Quit
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
|
||||||
case tea.KeyMsg:
|
case tea.KeyMsg:
|
||||||
switch msg.String() {
|
switch msg.String() {
|
||||||
case "ctrl+c", "esc":
|
case "ctrl+c", "esc":
|
||||||
|
|||||||
Reference in New Issue
Block a user