Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Allow third party hooks before main module load
Browse files Browse the repository at this point in the history
Just put a file lib/_third_party_main.js into the build directory and take
it from there.
  • Loading branch information
ry committed Jan 14, 2011
1 parent 860e7a7 commit 496be45
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/node.js
Expand Up @@ -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
Expand Down

1 comment on commit 496be45

@creationix
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Please sign in to comment.