Skip to content

_get_osfhandle in Addon fails on Windows #6369

Description

@davedoesdev
  • Version: v5.10.1
  • Platform: Windows 7, 8 and 10 (32 and 64 bit)
  • Subsystem: fs and Addons

_get_osfhandle fails to map a file descriptor opened in Javascript to a handle.

Please see https://github.com/davedoesdev/node-windows-fd-test for a simple repro. It's also seen in baudehlo/node-fs-ext#57 and nodejs/node-gyp#416

I think this is due to MSVCR being statically linked into Node. _get_osfhandle can't find a descriptor opened in Javascript because the file descriptor to handle map in the Addon is separate to the one statically linked into the Node executable.

It would be nice to be able to use file descriptors passed into Addons on Windows. One idea is to expose _get_osfhandle (or a wrapper) from the Node executable for Addons to link against and call.

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

    windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions