MCPcopy Index your code
hub / github.com/nodejs/node / prepareExecution

Function prepareExecution

lib/internal/process/pre_execution.js:105–182  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

103}
104
105function prepareExecution(options) {
106 const { expandArgv1, initializeModules, isMainThread, shouldSpawnLoaderHookWorker, shouldPreloadModules } = options;
107
108 refreshRuntimeOptions();
109
110 // Patch the process object and get the resolved main entry point.
111 const mainEntry = patchProcessObject(expandArgv1);
112 setupTraceCategoryState();
113 setupInspectorHooks();
114 setupNetworkInspection();
115 setupNavigator();
116 setupWarningHandler();
117 setupFFI();
118 setupSQLite();
119 setupStreamIter();
120 setupVfs();
121 setupQuic();
122 setupWebStorage();
123 setupWebsocket();
124 setupEventsource();
125 setupCodeCoverage();
126 setupDebugEnv();
127 // Process initial diagnostic reporting configuration, if present.
128 initializeReport();
129
130 setupDiagnosticsChannel();
131
132 // Load permission system API
133 initializePermission();
134
135 initializeSourceMapsHandlers();
136 initializeDeprecations();
137
138 initializeConfigFileSupport();
139
140 require('internal/dns/utils').initializeDns();
141
142 if (isMainThread) {
143 assert(internalBinding('worker').isMainThread);
144 // Worker threads will get the manifest in the message handler.
145
146 // Print stack trace on `SIGINT` if option `--trace-sigint` presents.
147 setupStacktracePrinterOnSigint();
148 initializeReportSignalHandlers(); // Main-thread-only.
149 initializeHeapSnapshotSignalHandlers();
150 // If the process is spawned with env NODE_CHANNEL_FD, it's probably
151 // spawned by our child_process module, then initialize IPC.
152 // This attaches some internal event listeners and creates:
153 // process.send(), process.channel, process.connected,
154 // process.disconnect().
155 setupChildProcessIpcChannel();
156 // If this is a worker in cluster mode, start up the communication
157 // channel. This needs to be done before any user code gets executed
158 // (including preload modules).
159 initializeClusterIPC();
160
161 // TODO(joyeecheung): do this for worker threads as well.
162 runDeserializeCallbacks();

Callers 3

Calls 15

refreshRuntimeOptionsFunction · 0.85
patchProcessObjectFunction · 0.85
setupTraceCategoryStateFunction · 0.85
setupInspectorHooksFunction · 0.85
setupNetworkInspectionFunction · 0.85
setupNavigatorFunction · 0.85
setupWarningHandlerFunction · 0.85
setupFFIFunction · 0.85
setupSQLiteFunction · 0.85
setupStreamIterFunction · 0.85
setupVfsFunction · 0.85
setupQuicFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…