hugolib: Fix error when deleting a bundle in server mode

Fixes #5077
This commit is contained in:
Bjørn Erik Pedersen 2018-08-15 17:14:03 +02:00
parent d999b4e82b
commit 0a88741fe8

View file

@ -135,11 +135,17 @@ func (c *capturer) capturePartial(filenames ...string) error {
switch tp { switch tp {
case bundleLeaf: case bundleLeaf:
if err := c.handleDir(resolvedFilename); err != nil { if err := c.handleDir(resolvedFilename); err != nil {
return err // Directory may have been deleted.
if !os.IsNotExist(err) {
return err
}
} }
case bundleBranch: case bundleBranch:
if err := c.handleBranchDir(resolvedFilename); err != nil { if err := c.handleBranchDir(resolvedFilename); err != nil {
return err // Directory may have been deleted.
if !os.IsNotExist(err) {
return err
}
} }
default: default:
fi, err := c.resolveRealPath(resolvedFilename) fi, err := c.resolveRealPath(resolvedFilename)
@ -510,7 +516,7 @@ func (c *capturer) readDir(dirname string) (pathLangFileFis, error) {
dir, err := c.fs.Open(dirname) dir, err := c.fs.Open(dirname)
if err != nil { if err != nil {
return nil, fmt.Errorf("readDir: %s", err) return nil, err
} }
defer dir.Close() defer dir.Close()
fis, err := dir.Readdir(-1) fis, err := dir.Readdir(-1)