cmd/cli: only cleanup log file if set

Otherwise, normalizeLogFilePath may return incorrect log file path,
causing invalid log file/backup initialization. Thus "--cleanup" will
complain about invalid files.
This commit is contained in:
Cuong Manh Le
2024-11-05 18:49:42 +07:00
committed by Cuong Manh Le
parent 84e06c363c
commit c5d14e0075
2 changed files with 10 additions and 12 deletions
+2 -5
View File
@@ -67,11 +67,8 @@ func Main() {
}
func normalizeLogFilePath(logFilePath string) string {
// In cleanup mode, we always want the full log file path.
if !cleanup {
if logFilePath == "" || filepath.IsAbs(logFilePath) || service.Interactive() {
return logFilePath
}
if logFilePath == "" || filepath.IsAbs(logFilePath) || service.Interactive() {
return logFilePath
}
if homedir != "" {
return filepath.Join(homedir, logFilePath)