summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-12-14 12:20:13 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-12-14 13:51:06 +0100
commitad2059878a8d6ace9669ccc5ff0a8d4e5811ad37 (patch)
tree34d88705ab22e5b54949a6ce48e028b1fc2ab7e6 /commands
parent87e898a17a52b5338bc9d554dd12b99a54aa2431 (diff)
Also consider wrapped errors when checking for file IsNotExist errors
Fixes #10534
Diffstat (limited to 'commands')
-rw-r--r--commands/hugo.go4
-rw-r--r--commands/static_syncer.go4
2 files changed, 4 insertions, 4 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index e26f052d4..e247fca27 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -579,7 +579,7 @@ func (c *commandeer) serverBuild() error {
func (c *commandeer) copyStatic() (map[string]uint64, error) {
m, err := c.doWithPublishDirs(c.copyStaticTo)
- if err == nil || os.IsNotExist(err) {
+ if err == nil || herrors.IsNotExist(err) {
return m, nil
}
return m, err
@@ -899,7 +899,7 @@ func (c *commandeer) newWatcher(pollIntervalStr string, dirList ...string) (*wat
}
unlock()
case err := <-watcher.Errors():
- if err != nil && !os.IsNotExist(err) {
+ if err != nil && !herrors.IsNotExist(err) {
c.logger.Errorln("Error while watching:", err)
}
}
diff --git a/commands/static_syncer.go b/commands/static_syncer.go
index b97c4df7a..c248ca152 100644
--- a/commands/static_syncer.go
+++ b/commands/static_syncer.go
@@ -14,9 +14,9 @@
package commands
import (
- "os"
"path/filepath"
+ "github.com/gohugoio/hugo/common/herrors"
"github.com/gohugoio/hugo/hugolib/filesystems"
"github.com/fsnotify/fsnotify"
@@ -95,7 +95,7 @@ func (s *staticSyncer) syncsStaticEvents(staticEvents []fsnotify.Event) error {
// the source of that static file. In this case Hugo will incorrectly remove that file
// from the published directory.
if ev.Op&fsnotify.Rename == fsnotify.Rename || ev.Op&fsnotify.Remove == fsnotify.Remove {
- if _, err := sourceFs.Fs.Stat(relPath); os.IsNotExist(err) {
+ if _, err := sourceFs.Fs.Stat(relPath); herrors.IsNotExist(err) {
// If file doesn't exist in any static dir, remove it
logger.Println("File no longer exists in static dir, removing", relPath)
_ = c.Fs.PublishDirStatic.RemoveAll(relPath)