This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Allow third party hooks before main module load

Just put a file lib/_third_party_main.js into the build directory and take
it from there.
  • Loading branch information...
1 parent 860e7a7 commit 496be457b6a2bc5b01ec13644b9c9783976159b2 @ry ry committed Jan 14, 2011
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/node.js
View
@@ -576,6 +576,16 @@
process.argv[0] = path.join(cwd, process.argv[0]);
}
+ // To allow people to extend Node in different ways, this hook allows
+ // one to drop a file lib/_third_party_main.js into the build directory
+ // which will be executed instead of Node's normal loading.
+ if (process.binding('natives')['_third_party_main']) {
+ process.nextTick(function () {
+ Module._requireNative('_third_party_main');
+ });
+ return;
+ }
+
if (process.argv[1]) {
if (process.argv[1] == 'debug') {
// Start the debugger agent

1 comment on commit 496be45

Nice, so this still requires rebuilding node, but it's a nice hook.

Please sign in to comment.