fix(windows): Hide command prompt windows during benchmarking

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 <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2025-12-28 19:25:55 -05:00
parent da49a1dd7b
commit b41e41e5ad

View File

@ -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)