Skip to content

Commit 9f45799

Browse files
vkurchatkinpiscisaureus
authored andcommittedJan 9, 2015
build: fix process.platform
e1fe270 introduces the NODE_PLATFORM macro which had to be redefined in node.gyp for `process.platform` to return expected values. PR-URL: nodejs#271 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Bert Belder <[email protected]>
1 parent be2404e commit 9f45799

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed
 

‎node.gyp

+5-5
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@
325325
'defines': [
326326
'FD_SETSIZE=1024',
327327
# we need to use node's preferred "win32" rather than gyp's preferred "win"
328-
'PLATFORM="win32"',
328+
'NODE_PLATFORM="win32"',
329329
'_UNICODE=1',
330330
],
331331
'libraries': [ '-lpsapi.lib' ]
@@ -337,11 +337,11 @@
337337
# like Instruments require it for some features
338338
'libraries': [ '-framework CoreFoundation' ],
339339
'defines!': [
340-
'PLATFORM="mac"',
340+
'NODE_PLATFORM="mac"',
341341
],
342342
'defines': [
343343
# we need to use node's preferred "darwin" rather than gyp's preferred "mac"
344-
'PLATFORM="darwin"',
344+
'NODE_PLATFORM="darwin"',
345345
],
346346
}],
347347
[ 'OS=="freebsd"', {
@@ -356,12 +356,12 @@
356356
'-lumem',
357357
],
358358
'defines!': [
359-
'PLATFORM="solaris"',
359+
'NODE_PLATFORM="solaris"',
360360
],
361361
'defines': [
362362
# we need to use node's preferred "sunos"
363363
# rather than gyp's preferred "solaris"
364-
'PLATFORM="sunos"',
364+
'NODE_PLATFORM="sunos"',
365365
],
366366
}],
367367
[ 'OS=="freebsd" or OS=="linux"', {

‎src/node.cc

+3-8
Original file line numberDiff line numberDiff line change
@@ -2625,14 +2625,9 @@ void SetupProcessObject(Environment* env,
26252625
READONLY_PROPERTY(process, "arch", OneByteString(env->isolate(), NODE_ARCH));
26262626

26272627
// process.platform
2628-
#ifdef _WIN32
2629-
// As determined by gyp, NODE_PLATFORM equals 'win' on windows. However
2630-
// for historic reasons process.platform should be 'win32'.
2631-
Local<String> platform = OneByteString(env->isolate(), "win32");
2632-
#else
2633-
Local<String> platform = OneByteString(env->isolate(), NODE_PLATFORM);
2634-
#endif
2635-
READONLY_PROPERTY(process, "platform", platform);
2628+
READONLY_PROPERTY(process,
2629+
"platform",
2630+
OneByteString(env->isolate(), NODE_PLATFORM));
26362631

26372632
// process.argv
26382633
Local<Array> arguments = Array::New(env->isolate(), argc);

0 commit comments

Comments
 (0)
Please sign in to comment.