Skip to content

Commit df3b006

Browse files
committed
fix(logs): ignore ENOENT when truncating default log file
1 parent 72cb268 commit df3b006

File tree

1 file changed

+1
-1
lines changed
  • internal/api/handlers/management

1 file changed

+1
-1
lines changed

internal/api/handlers/management/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (h *Handler) DeleteLogs(c *gin.Context) {
116116
name := entry.Name()
117117
fullPath := filepath.Join(dir, name)
118118
if name == defaultLogFileName {
119-
if errTrunc := os.Truncate(fullPath, 0); errTrunc != nil {
119+
if errTrunc := os.Truncate(fullPath, 0); errTrunc != nil && !os.IsNotExist(errTrunc) {
120120
c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Sprintf("failed to truncate log file: %v", errTrunc)})
121121
return
122122
}

0 commit comments

Comments
 (0)