mirror of
https://github.com/nodejs/node.git
synced 2025-05-08 11:21:41 +00:00

Since this is only necessary when user code execution is expected. PR-URL: https://github.com/nodejs/node/pull/25825 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
47 lines
1.0 KiB
JavaScript
47 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
// Create the REPL if `-i` or `--interactive` is passed, or if
|
|
// the main module is not specified and stdin is a TTY.
|
|
|
|
const {
|
|
initializeDeprecations,
|
|
initializeClusterIPC,
|
|
initializePolicy,
|
|
initializeESMLoader,
|
|
loadPreloadModules
|
|
} = require('internal/bootstrap/pre_execution');
|
|
|
|
const {
|
|
evalScript
|
|
} = require('internal/process/execution');
|
|
|
|
initializeDeprecations();
|
|
initializeClusterIPC();
|
|
initializePolicy();
|
|
initializeESMLoader();
|
|
loadPreloadModules();
|
|
|
|
const cliRepl = require('internal/repl');
|
|
cliRepl.createInternalRepl(process.env, (err, repl) => {
|
|
if (err) {
|
|
throw err;
|
|
}
|
|
repl.on('exit', () => {
|
|
if (repl._flushing) {
|
|
repl.pause();
|
|
return repl.once('flushHistory', () => {
|
|
process.exit();
|
|
});
|
|
}
|
|
process.exit();
|
|
});
|
|
});
|
|
|
|
// If user passed '-e' or '--eval' along with `-i` or `--interactive`,
|
|
// evaluate the code in the current context.
|
|
if (process._eval != null) {
|
|
evalScript('[eval]', process._eval, process._breakFirstLine);
|
|
}
|
|
|
|
markBootstrapComplete();
|