diff --git a/node.gyp b/node.gyp index 10ca1bc2b59501..30a1bdf7ebc191 100644 --- a/node.gyp +++ b/node.gyp @@ -164,11 +164,11 @@ ], 'defines': [ - 'NODE_WANT_INTERNALS=1', - 'ARCH="<(target_arch)"', - 'PLATFORM="<(OS)"', + 'NODE_ARCH="<(target_arch)"', + 'NODE_PLATFORM="<(OS)"', 'NODE_TAG="<(node_tag)"', 'NODE_V8_OPTIONS="<(node_v8_options)"', + 'NODE_WANT_INTERNALS=1', ], 'conditions': [ diff --git a/src/node.cc b/src/node.cc index 1a4b18089042cc..e900e619d96b80 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2623,12 +2623,17 @@ void SetupProcessObject(Environment* env, #endif // process.arch - READONLY_PROPERTY(process, "arch", OneByteString(env->isolate(), ARCH)); + READONLY_PROPERTY(process, "arch", OneByteString(env->isolate(), NODE_ARCH)); // process.platform - READONLY_PROPERTY(process, - "platform", - OneByteString(env->isolate(), PLATFORM)); +#ifdef _WIN32 + // As determined by gyp, NODE_PLATFORM equals 'win' on windows. However + // for historic reasons process.platform should be 'win32'. + Local platform = OneByteString(env->isolate(), "win32"); +#else + Local platform = OneByteString(env->isolate(), NODE_PLATFORM); +#endif + READONLY_PROPERTY(process, "platform", platform); // process.argv Local arguments = Array::New(env->isolate(), argc);