Skip to content

Commit

Permalink
Add check for on/after EOF
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotsayes committed Dec 12, 2024
1 parent 7e39e0d commit 00a67cc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions extensions/weavedrive/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ module.exports = function weaveDrive (mod, FS) {
mod.HEAP8.set(stream.node.contents.subarray(0, toRead), dstPtr)
return toRead
}

// console.log(`stream.node.total_size: ${stream.node.total_size}, stream.position: ${stream.position}, to_read: ${to_read}`)
if (stream.position >= stream.node.total_size) {
// console.log("WeaveDrive: EOF reached.")
return 0;
}

// Satisfy what we can with the cache first
let bytesRead = this.readFromCache(stream, dstPtr, toRead)
stream.position += bytesRead
Expand Down

0 comments on commit 00a67cc

Please sign in to comment.