debug(author): add detailed command logging to runCommandWithLogger

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 <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2026-01-10 01:33:47 -05:00
parent 3cee42d041
commit 9922738f7c

View File

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