Skip to content

Commit

Permalink
Fix WASM fs in stackblitz
Browse files Browse the repository at this point in the history
  • Loading branch information
devongovett committed Jul 30, 2023
1 parent 8c90a16 commit 3a7a6db
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions wasm/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ const wasi = {
let ptr = env.u32[iov >> 2];
let len = env.u32[(iov + 4) >> 2];
iov += 8;
buffers.push(env.memory.subarray(ptr, ptr + len));
if (len > 0) {
buffers.push(env.memory.subarray(ptr, ptr + len));
}
}
let wrote = fs.writevSync(fd, buffers);
env.u32[pnum >> 2] = wrote;
Expand All @@ -235,7 +237,9 @@ const wasi = {
let ptr = env.u32[iov >> 2];
let len = env.u32[(iov + 4) >> 2];
iov += 8;
buffers.push(env.memory.subarray(ptr, ptr + len));
if (len > 0) {
buffers.push(env.memory.subarray(ptr, ptr + len));
}
}

let read = fs.readvSync(fd, buffers);
Expand Down

0 comments on commit 3a7a6db

Please sign in to comment.