forked from mirror/afero
parent
5e9f8ecaa4
commit
a5d6946387
|
@ -282,7 +282,8 @@ func (u *CopyOnWriteFs) MkdirAll(name string, perm os.FileMode) error {
|
||||||
return u.layer.MkdirAll(name, perm)
|
return u.layer.MkdirAll(name, perm)
|
||||||
}
|
}
|
||||||
if dir {
|
if dir {
|
||||||
return ErrFileExists
|
// This is in line with how os.MkdirAll behaves.
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return u.layer.MkdirAll(name, perm)
|
return u.layer.MkdirAll(name, perm)
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,13 +36,12 @@ func TestCopyOnWrite(t *testing.T) {
|
||||||
t.Errorf("Mkdir: Got %q for %T", err, fs)
|
t.Errorf("Mkdir: Got %q for %T", err, fs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/spf13/afero/issues/191
|
// MkdirAll does not return an error when the directory already exists
|
||||||
if _, ok := fs.(*OsFs); !ok {
|
err = fs.MkdirAll(dir, 0744)
|
||||||
err = fs.MkdirAll(dir, 0744)
|
if err != nil {
|
||||||
if err == nil || !os.IsExist(err) {
|
t.Errorf("MkdirAll: Got %q for %T", err, fs)
|
||||||
t.Errorf("MkdirAll: Got %q for %T", err, fs)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue