From a0a401cab1120960a14c02debe7a42582a01afb4 Mon Sep 17 00:00:00 2001 From: Alexander Renz Date: Sun, 18 Jan 2026 18:17:00 +0100 Subject: [PATCH] fix(tui): suppress preflight stdout output in TUI mode to prevent scrambled display - Add silentMode field to restore Engine struct - Set silentMode=true in NewSilent() constructor for TUI mode - Skip fmt.Println output in printPreflightSummary when in silent mode - Log summary instead of printing to stdout in TUI mode - Fixes scrambled output during cluster restore preflight checks --- bin/README.md | 4 ++-- internal/restore/engine.go | 2 ++ internal/restore/preflight.go | 13 +++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/bin/README.md b/bin/README.md index d52074d..8060a76 100644 --- a/bin/README.md +++ b/bin/README.md @@ -4,8 +4,8 @@ This directory contains pre-compiled binaries for the DB Backup Tool across mult ## Build Information - **Version**: 3.42.50 -- **Build Time**: 2026-01-18_11:19:47_UTC -- **Git Commit**: 490a12f +- **Build Time**: 2026-01-18_11:39:42_UTC +- **Git Commit**: 59a717a ## Recent Updates (v1.1.0) - ✅ Fixed TUI progress display with line-by-line output diff --git a/internal/restore/engine.go b/internal/restore/engine.go index af977a7..611c0b8 100755 --- a/internal/restore/engine.go +++ b/internal/restore/engine.go @@ -50,6 +50,7 @@ type Engine struct { progress progress.Indicator detailedReporter *progress.DetailedReporter dryRun bool + silentMode bool // Suppress stdout output (for TUI mode) debugLogPath string // Path to save debug log on error // TUI progress callback for detailed progress reporting @@ -86,6 +87,7 @@ func NewSilent(cfg *config.Config, log logger.Logger, db database.Database) *Eng progress: progressIndicator, detailedReporter: detailedReporter, dryRun: false, + silentMode: true, // Suppress stdout for TUI } } diff --git a/internal/restore/preflight.go b/internal/restore/preflight.go index cb0528c..27b3442 100644 --- a/internal/restore/preflight.go +++ b/internal/restore/preflight.go @@ -542,7 +542,20 @@ func (e *Engine) calculateRecommendedParallel(result *PreflightResult) int { } // printPreflightSummary prints a nice summary of all checks +// In silent mode (TUI), this is skipped and results are logged instead func (e *Engine) printPreflightSummary(result *PreflightResult) { + // In TUI/silent mode, don't print to stdout - it causes scrambled output + if e.silentMode { + // Log summary instead for debugging + e.log.Info("Preflight checks complete", + "can_proceed", result.CanProceed, + "warnings", len(result.Warnings), + "errors", len(result.Errors), + "total_blobs", result.Archive.TotalBlobCount, + "recommended_locks", result.Archive.RecommendedLockBoost) + return + } + fmt.Println() fmt.Println(strings.Repeat("─", 60)) fmt.Println(" PREFLIGHT CHECKS")