gojs: ensures Mkdir(path, 0) works (#1208)
Go has a test that forces us to handle Mkdir with zero as its permissions. In GOOS=js, the result of fs.mkdir is a file descriptor, and to open that, we can't use literally 0. Hence, to solve this we need to coerce 0 to 0500 in GOOS=js. Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -454,6 +454,10 @@ func (jsfsMkdir) invoke(ctx context.Context, mod api.Module, args ...interface{}
|
||||
|
||||
var fd uint32
|
||||
var err error
|
||||
// We need at least read access to open the file descriptor
|
||||
if perm == 0 {
|
||||
perm = 0o0500
|
||||
}
|
||||
if err = root.Mkdir(path, fs.FileMode(perm)); err == nil {
|
||||
fd, err = fsc.OpenFile(root, path, os.O_RDONLY, 0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user