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

Commit 496be45

Browse files
committed
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.
1 parent 860e7a7 commit 496be45

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/node.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,16 @@
576576
process.argv[0] = path.join(cwd, process.argv[0]);
577577
}
578578

579+
// To allow people to extend Node in different ways, this hook allows
580+
// one to drop a file lib/_third_party_main.js into the build directory
581+
// which will be executed instead of Node's normal loading.
582+
if (process.binding('natives')['_third_party_main']) {
583+
process.nextTick(function () {
584+
Module._requireNative('_third_party_main');
585+
});
586+
return;
587+
}
588+
579589
if (process.argv[1]) {
580590
if (process.argv[1] == 'debug') {
581591
// Start the debugger agent

0 commit comments

Comments
 (0)