From 9922738f7cbf30d390487e99b4f0d98e88249f29 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Sat, 10 Jan 2026 01:33:47 -0500 Subject: [PATCH] debug(author): add detailed command logging to runCommandWithLogger MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhanced runCommandWithLogger to log: 1. The exact command being executed (before execution) 2. Any errors when starting the command 3. Exit codes when commands fail Before: - No visibility into what command failed - Silent failures during menu generation - Log just showed "ERROR: FFmpeg failed during DVD encoding" After: - >> /usr/bin/ffmpeg [args...] (shows exact command) - ERROR starting command: [error] (if command won't start) - ERROR command failed: [error] (exit code: X) (if command fails) This will help diagnose the menu generation failures by showing exactly what FFmpeg command is failing and why. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- author_module.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/author_module.go b/author_module.go index 0ae261d..39b4500 100644 --- a/author_module.go +++ b/author_module.go @@ -3248,6 +3248,11 @@ Title: %s } func runCommandWithLogger(ctx context.Context, name string, args []string, logFn func(string)) error { + // Log the command being executed for debugging + if logFn != nil { + logFn(fmt.Sprintf(">> %s %s", name, strings.Join(args, " "))) + } + cmd := exec.CommandContext(ctx, name, args...) utils.ApplyNoWindow(cmd) stdout, err := cmd.StdoutPipe() @@ -3260,6 +3265,9 @@ func runCommandWithLogger(ctx context.Context, name string, args []string, logFn } if err := cmd.Start(); err != nil { + if logFn != nil { + logFn(fmt.Sprintf("ERROR starting command: %v", err)) + } return fmt.Errorf("%s start: %w", name, err) } @@ -3281,6 +3289,9 @@ func runCommandWithLogger(ctx context.Context, name string, args []string, logFn err = cmd.Wait() wg.Wait() if err != nil { + if logFn != nil { + logFn(fmt.Sprintf("ERROR command failed: %v (exit code: %v)", err, cmd.ProcessState.ExitCode())) + } return fmt.Errorf("%s failed: %w", name, err) } return nil