Closed
Description
- 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.