mirror of https://github.com/spf13/afero.git
parent
5660eeed30
commit
8d919cbe7e
|
@ -80,7 +80,7 @@ func (u *CopyOnWriteFs) Stat(name string) (os.FileInfo, error) {
|
|||
if e, ok := err.(*os.PathError); ok {
|
||||
err = e.Err
|
||||
}
|
||||
if err == syscall.ENOENT || err == syscall.ENOTDIR {
|
||||
if err == os.ErrNotExist || err == syscall.ENOENT || err == syscall.ENOTDIR {
|
||||
return u.base.Stat(name)
|
||||
}
|
||||
return nil, origErr
|
||||
|
|
|
@ -21,3 +21,19 @@ func TestCopyOnWrite(t *testing.T) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
func TestCopyOnWriteFileInMemMapBase(t *testing.T) {
|
||||
base := &MemMapFs{}
|
||||
layer := &MemMapFs{}
|
||||
|
||||
if err := WriteFile(base, "base.txt", []byte("base"), 0755); err != nil {
|
||||
t.Fatalf("Failed to write file: %s", err)
|
||||
}
|
||||
|
||||
ufs := NewCopyOnWriteFs(base, layer)
|
||||
|
||||
_, err := ufs.Stat("base.txt")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue