Skip to content

Commit 9369b38

Browse files
GiteaBotwxiaoguang
andauthoredJul 17, 2023
Skip unuseful error message in dev mode when watching local filesystem (go-gitea#25919) (go-gitea#25927)
Backport go-gitea#25919 by @wxiaoguang Before, in dev mode, there might be some error logs like: ``` 2023/07/17 13:54:51 ...s/assetfs/layered.go:221:WatchLocalChanges() [E] Unable to watch directory .: lstat /data/work/gitea/custom/templates: no such file or directory ``` Because there is no "custom/templates" directory. After: ignore such error, no such error message anymore. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 parent 6e82d0b commit 9369b38

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎modules/assetfs/layered.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func (l *LayeredFS) WatchLocalChanges(ctx context.Context, callback func()) {
217217
}
218218
layerDirs = append(layerDirs, ".")
219219
for _, dir := range layerDirs {
220-
if err = watcher.Add(util.FilePathJoinAbs(layer.localPath, dir)); err != nil {
220+
if err = watcher.Add(util.FilePathJoinAbs(layer.localPath, dir)); err != nil && !os.IsNotExist(err) {
221221
log.Error("Unable to watch directory %s: %v", dir, err)
222222
}
223223
}

0 commit comments

Comments
 (0)
Please sign in to comment.