diff options
author | Casper Beyer <caspervonb@pm.me> | 2020-06-29 22:44:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-29 10:44:08 -0400 |
commit | 4cde7fdc9a52088f8dfe3e23569d6be2faa80d0f (patch) | |
tree | 71676360379f9797543d525aee086670e1735f44 /std/wasi/snapshot_preview1.ts | |
parent | 53f8d96a1faf3b0f97e793b2e4ea86c64c12cbfa (diff) |
feat(std/wasi): implement fd_datasync (#6556)
Diffstat (limited to 'std/wasi/snapshot_preview1.ts')
-rw-r--r-- | std/wasi/snapshot_preview1.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/std/wasi/snapshot_preview1.ts b/std/wasi/snapshot_preview1.ts index 78b29b968..d52b81635 100644 --- a/std/wasi/snapshot_preview1.ts +++ b/std/wasi/snapshot_preview1.ts @@ -492,7 +492,18 @@ export default class Module { }, fd_datasync: (fd: number): number => { - return ERRNO_NOSYS; + const entry = this.fds[fd]; + if (!entry) { + return ERRNO_BADF; + } + + try { + Deno.fdatasyncSync(entry.handle.rid); + } catch (err) { + return errno(err); + } + + return ERRNO_SUCCESS; }, fd_fdstat_get: (fd: number, stat_out: number): number => { |