gojs: implements remaining link functions (#1198)
This implements the last remaining link functions using the same logic as WASI. In doing so, this changes the signature for FS.ReadLink to be more similar to the rest of the functions. Particularly, it stops reading the result into a buffer. After this, the only syscalls left to implement in gojs are chown. Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -664,9 +664,8 @@ func (jsfsReadlink) invoke(ctx context.Context, mod api.Module, args ...interfac
|
||||
path := args[0].(string)
|
||||
callback := args[1].(funcWrapper)
|
||||
|
||||
_ = path // TODO
|
||||
var dst string
|
||||
var err error = syscall.ENOSYS
|
||||
fsc := mod.(*wasm.CallContext).Sys.FS()
|
||||
dst, err := fsc.RootFS().Readlink(path)
|
||||
|
||||
return callback.invoke(ctx, mod, goos.RefJsfs, err, dst) // note: error first
|
||||
}
|
||||
@@ -681,8 +680,8 @@ func (jsfsLink) invoke(ctx context.Context, mod api.Module, args ...interface{})
|
||||
link := args[1].(string)
|
||||
callback := args[2].(funcWrapper)
|
||||
|
||||
_, _ = path, link // TODO
|
||||
var err error = syscall.ENOSYS
|
||||
fsc := mod.(*wasm.CallContext).Sys.FS()
|
||||
err := fsc.RootFS().Link(path, link)
|
||||
|
||||
return jsfsInvoke(ctx, mod, callback, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user