mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-12 15:50:15 -08:00
fix(cli): always output fatal errors to stderr (#6827)
Signed-off-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
@@ -67,7 +67,8 @@ func Errorf(format string, args ...any) { slog.Default().Error(fmt.Sprintf(forma
|
||||
|
||||
// Fatal for logging fatal errors
|
||||
func Fatal(msg string, args ...any) {
|
||||
slog.Default().Log(context.Background(), LevelFatal, msg, args...)
|
||||
// Fatal errors should be logged to stderr even if the logger is disabled.
|
||||
New(NewHandler(os.Stderr, &Options{})).Log(context.Background(), LevelFatal, msg, args...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user