Backend: Print top-level CLI errors to stderr, not the DB logger #5637

This commit is contained in:
Michael Mayer 2026-06-03 08:45:43 +00:00
parent 5bf4a73aba
commit 395bd76ee3

View file

@ -23,6 +23,7 @@ Additional information can be found in our Developer Guide:
package main
import (
"fmt"
"os"
"github.com/urfave/cli/v2"
@ -33,7 +34,6 @@ import (
)
var version = "development"
var log = event.Log
const appName = "PhotoPrism"
const appAbout = "PhotoPrism®"
@ -70,7 +70,10 @@ func main() {
app.Commands = commands.PhotoPrism
app.Metadata = Metadata
// urfave/cli prints and exits with the code of any cli.Exit(...) error
// before returning here, so only plain errors reach this point; report
// them on stderr without forcing a specific exit code.
if err := app.Run(os.Args); err != nil {
log.Error(err)
_, _ = fmt.Fprintln(os.Stderr, err)
}
}