fix(logs): ignore ENOENT when truncating default log file
This commit is contained in:
1 parent
72cb2689e8
commit
df3b00621a
1 file changed
+1
-1
@@ -116,7 +116,7 @@ func (h *Handler) DeleteLogs(c *gin.Context) {
|
||||
name := entry.Name()
|
||||
fullPath := filepath.Join(dir, name)
|
||||
if name == defaultLogFileName {
|
||||
if errTrunc := os.Truncate(fullPath, 0); errTrunc != nil {
|
||||
if errTrunc := os.Truncate(fullPath, 0); errTrunc != nil && !os.IsNotExist(errTrunc) {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Sprintf("failed to truncate log file: %v", errTrunc)})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user