Skip to content

fs.openSync doesn't seem to have access to the vfs in sea mode. #302

Description

@spotandjake

What version of pkg are you using?

6.22.0

What version of Node.js are you using?

24.21.0

What operating system are you using?

macOS

What CPU architecture are you using?

arm64

What Node versions, OSs and CPU architectures are you building for?

node24-macos-arm64

Describe the Bug

When I make the fs calls below, the readFileSync call resolves correctly however the openSync call fails with: no such file or directory, open '/snapshot/grain/stdlib/array.gr'

console.log(fs.readFileSync("/snapshot/grain/stdlib/array.gr", "utf8"));
console.log(fs.openSync("/snapshot/grain/stdlib/array.gr"));

If i'm not mistaken this is because the vfs-setup doesn't actually implement openSync and when the underlying MemoryProvider is initialized only the directories are loaded in and not the files. I looked into this a bit deeper I'm wondering if the actual problem I am running into is that installFsPatches in the vfs modules module_hooks doesn't seem to patch openSync at all.

Expected Behavior

The expected behaviour would t have it return a virtual file descriptor.

To Reproduce

I'm pretty sure you can just compare the result of openSync vs readFileSync on any file in the vfs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions