From b41e41e5ad5ace69177aca3bdede0c58c189665f Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Sun, 28 Dec 2025 19:25:55 -0500 Subject: [PATCH] fix(windows): Hide command prompt windows during benchmarking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: - Jake reported command prompts popping up during benchmark runs on Windows - FFmpeg processes were showing console windows during tests - Disruptive user experience, not discreet Root Cause: - exec.CommandContext on Windows shows command prompt by default - Benchmark suite runs multiple FFmpeg processes (test video generation + encoder tests) - No platform-specific window hiding applied Solution: - Apply utils.ApplyNoWindow() to all FFmpeg benchmark commands - Uses SysProcAttr{HideWindow: true} on Windows - No-op on Linux/macOS (cross-platform safe) Implementation: - Import internal/utils in benchmark package - Call ApplyNoWindow() on test video generation command - Call ApplyNoWindow() on each encoder benchmark test command - Ensures all benchmark processes run hidden on Windows Files Changed: - internal/benchmark/benchmark.go: Added ApplyNoWindow() calls Platform-Specific Code: - internal/utils/proc_windows.go: HideWindow implementation (existing) - internal/utils/proc_other.go: No-op implementation (existing) Impact: - Clean, discreet benchmarking on Windows - No console windows popping up during tests - Same behavior on all platforms Reported-by: Jake (Windows command prompt popups) Tested-on: Linux (build successful, no-op behavior verified) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- internal/benchmark/benchmark.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/benchmark/benchmark.go b/internal/benchmark/benchmark.go index 7e83c1f..ad061cf 100644 --- a/internal/benchmark/benchmark.go +++ b/internal/benchmark/benchmark.go @@ -7,6 +7,8 @@ import ( "os/exec" "path/filepath" "time" + + "git.leaktechnologies.dev/stu/VideoTools/internal/utils" ) // Result stores the outcome of a single encoder benchmark test @@ -60,6 +62,7 @@ func (s *Suite) GenerateTestVideo(ctx context.Context, duration int) (string, er } cmd := exec.CommandContext(ctx, s.FFmpegPath, args...) + utils.ApplyNoWindow(cmd) // Hide command window on Windows during benchmark test video generation if err := cmd.Run(); err != nil { return "", fmt.Errorf("failed to generate test video: %w", err) } @@ -131,6 +134,7 @@ func (s *Suite) TestEncoder(ctx context.Context, encoder, preset string) Result // Measure encoding time start := time.Now() cmd := exec.CommandContext(ctx, s.FFmpegPath, args...) + utils.ApplyNoWindow(cmd) // Hide command window on Windows during benchmark encoding test if err := cmd.Run(); err != nil { result.Error = fmt.Sprintf("encoding failed: %v", err)