Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

process: add `process.config`

This is the JS representation of the `config.gypi` file that was used when
compiling node. With this information, you can tell whether the current node
binary has shared or static dependencies, or any other configuration options
that may have been used.
  • Loading branch information...
commit 293d9a271b4eae3332af1eae3586e36d139eb509 1 parent 585421e
@TooTallNate authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/node.js
View
14 src/node.js
@@ -37,6 +37,7 @@
startup.globalConsole();
startup.processAssert();
+ startup.processConfig();
startup.processNextTick();
startup.processStdio();
startup.processKillAndExit();
@@ -177,6 +178,15 @@
};
};
+ startup.processConfig = function() {
+ config = config.split('\n').slice(1).join('\n').replace(/'/g, '"');
+ process.config = JSON.parse(config, function(key, value) {
+ if (value === 'true') return true;
+ if (value === 'false') return false;
+ return value;
+ });
+ }
+
startup.processNextTick = function() {
var nextTickQueue = [];
@@ -467,6 +477,10 @@
NativeModule._source = process.binding('natives');
NativeModule._cache = {};
+ // used for `process.config`, but not a real module
+ var config = NativeModule._source.config;
+ delete NativeModule._source.config;
+
NativeModule.require = function(id) {
if (id == 'native_module') {
return NativeModule;
Please sign in to comment.
Something went wrong with that request. Please try again.