Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(std/wasi): return flags from fd_fdstat_get #7112

Merged
merged 5 commits into from
Aug 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions std/wasi/snapshot_preview1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,17 @@ export default class Context {

this.fds = [
{
fdflags: FDFLAGS_APPEND,
type: FILETYPE_CHARACTER_DEVICE,
handle: Deno.stdin,
},
{
fdflags: FDFLAGS_APPEND,
type: FILETYPE_CHARACTER_DEVICE,
handle: Deno.stdout,
},
{
fdflags: FDFLAGS_APPEND,
type: FILETYPE_CHARACTER_DEVICE,
handle: Deno.stderr,
},
Expand Down Expand Up @@ -521,7 +524,7 @@ export default class Context {

const view = new DataView(this.memory.buffer);
view.setUint8(stat_out, entry.type);
view.setUint16(stat_out + 4, 0, true); // TODO
view.setUint16(stat_out + 2, entry.fdflags, true);
view.setBigUint64(stat_out + 8, 0n, true); // TODO
view.setBigUint64(stat_out + 16, 0n, true); // TODO

Expand Down Expand Up @@ -1155,9 +1158,9 @@ export default class Context {
// directory this way so there's no native fstat but Deno.open
// doesn't work with directories on windows so we'll have to work
// around it for now.

const entries = Array.from(Deno.readDirSync(path));
const opened_fd = this.fds.push({
fdflags,
entries,
path,
}) - 1;
Expand Down Expand Up @@ -1237,6 +1240,7 @@ export default class Context {

const handle = Deno.openSync(path, options);
const opened_fd = this.fds.push({
fdflags,
handle,
path,
}) - 1;
Expand Down