summaryrefslogtreecommitdiff
path: root/std/wasi/snapshot_preview1.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/wasi/snapshot_preview1.ts')
-rw-r--r--std/wasi/snapshot_preview1.ts13
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 => {