From fb65e55c983ed9bd325993dc72cec842c8c240d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 10 Feb 2025 12:28:36 +0100 Subject: [PATCH] Worker: improve warning when FFmpeg cannot be found On Linux (at least my Ubuntu) the error from finding FFmpeg wasn't identified as a "file not found" error, and thus the more abstract "unexpected error" message was logged. Now any error with "file not found" in the message is handled as such, and just produces a warning without the word "error" in there. --- cmd/flamenco-worker/find_exes.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/flamenco-worker/find_exes.go b/cmd/flamenco-worker/find_exes.go index cfe14da6..b7f6203c 100644 --- a/cmd/flamenco-worker/find_exes.go +++ b/cmd/flamenco-worker/find_exes.go @@ -5,6 +5,7 @@ import ( "errors" "io/fs" "os/exec" + "strings" "time" "github.com/rs/zerolog/log" @@ -18,10 +19,10 @@ import ( func findFFmpeg() { result, err := find_ffmpeg.Find() switch { - case errors.Is(err, fs.ErrNotExist): - log.Warn().Msg("FFmpeg could not be found on this system, render jobs may not run correctly") + case errors.Is(err, fs.ErrNotExist), strings.Contains(err.Error(), "file not found"): + log.Warn().Msg("FFmpeg could not be found on this system, jobs may not run correctly") case err != nil: - log.Warn().Err(err).Msg("there was an unexpected error finding FFmpeg on this system, render jobs may not run correctly") + log.Warn().AnErr("cause", err).Msg("there was an unexpected error finding FFmpeg on this system, jobs may not run correctly") default: log.Info().Str("path", result.Path).Str("version", result.Version).Msg("FFmpeg found on this system") }