mirror of
https://github.com/photoprism/photoprism.git
synced 2026-07-17 16:49:04 +00:00
Backend: Print top-level CLI errors to stderr, not the DB logger #5637
This commit is contained in:
parent
5bf4a73aba
commit
395bd76ee3
1 changed files with 5 additions and 2 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue