Skip to content

Commit

Permalink
Return correct error for fd_seek on a directory
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Apr 8, 2024
1 parent 395bccf commit a11b195
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/fs_core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ export class OpenDirectory extends Fd {
this.dir = dir;
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
fd_seek(offset: bigint, whence: number): { ret: number; offset: bigint } {
return { ret: wasi.ERRNO_ISDIR, offset: 0n };
}

fd_fdstat_get(): { ret: number; fdstat: wasi.Fdstat | null } {
return { ret: 0, fdstat: new wasi.Fdstat(wasi.FILETYPE_DIRECTORY, 0) };
}
Expand Down
1 change: 0 additions & 1 deletion test/skip.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"nofollow_errors": "fail",
"path_open_preopen": "fail",
"fd_readdir": "fail",
"directory_seek": "fail",
"symlink_filestat": "fail",
"symlink_loop": "fail",
"interesting_paths": "fail"
Expand Down

0 comments on commit a11b195

Please sign in to comment.