77
88namespace {
99
10+ using v8::BigInt;
1011using v8::Context;
1112using v8::FunctionCallbackInfo;
1213using v8::Isolate;
1314using v8::Local;
14- using v8::Number;
1515using v8::Object;
1616using v8::String;
1717using v8::Value;
1818
1919// Creates an anonymous pipe and returns its raw Win32 read/write HANDLE values
20- // as JS numbers . These are NOT CRT file descriptors, so passing them as the
20+ // as JS bigints . These are NOT CRT file descriptors, so passing them as the
2121// `windowsHandle` stream option exercises the HANDLE -> fd conversion path on
2222// Windows. Returns undefined on other platforms.
2323void CreatePipeHandles (const FunctionCallbackInfo<Value>& args) {
@@ -37,16 +37,16 @@ void CreatePipeHandles(const FunctionCallbackInfo<Value>& args) {
3737 result
3838 ->Set (context,
3939 String::NewFromUtf8 (isolate, " readHandle" ).ToLocalChecked (),
40- Number ::New (isolate,
41- static_cast < double >(
42- reinterpret_cast <intptr_t >(read_handle))))
40+ BigInt ::New (
41+ isolate,
42+ static_cast < int64_t >( reinterpret_cast <intptr_t >(read_handle))))
4343 .Check ();
4444 result
4545 ->Set (context,
4646 String::NewFromUtf8 (isolate, " writeHandle" ).ToLocalChecked (),
47- Number ::New (isolate,
48- static_cast < double >(
49- reinterpret_cast <intptr_t >(write_handle))))
47+ BigInt ::New (
48+ isolate,
49+ static_cast < int64_t >( reinterpret_cast <intptr_t >(write_handle))))
5050 .Check ();
5151 args.GetReturnValue ().Set (result);
5252#else
@@ -56,9 +56,7 @@ void CreatePipeHandles(const FunctionCallbackInfo<Value>& args) {
5656
5757} // anonymous namespace
5858
59- extern " C" NODE_MODULE_EXPORT void
60- NODE_MODULE_INITIALIZER (Local<Object> exports,
61- Local<Value> module ,
62- Local<Context> context) {
59+ extern " C" NODE_MODULE_EXPORT void NODE_MODULE_INITIALIZER (
60+ Local<Object> exports, Local<Value> module , Local<Context> context) {
6361 NODE_SET_METHOD (exports, " createPipeHandles" , CreatePipeHandles);
6462}
0 commit comments