mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
49ee010005
This patch reduce usage of `process._breakFirstLine` and `process._eval` in the internals and use `getOptionValue('--inspect-brk')` and `getOptionValue('--eval')` instead wherever possible. PR-URL: https://github.com/nodejs/node/pull/27278 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
34 lines
790 B
JavaScript
34 lines
790 B
JavaScript
'use strict';
|
|
|
|
// Stdin is not a TTY, we will read it and execute it.
|
|
|
|
const {
|
|
prepareMainThreadExecution
|
|
} = require('internal/bootstrap/pre_execution');
|
|
|
|
const { getOptionValue } = require('internal/options');
|
|
|
|
const {
|
|
evalModule,
|
|
evalScript,
|
|
readStdin
|
|
} = require('internal/process/execution');
|
|
|
|
prepareMainThreadExecution();
|
|
markBootstrapComplete();
|
|
|
|
readStdin((code) => {
|
|
// This is necessary for fork() and CJS module compilation.
|
|
// TODO(joyeecheung): pass this with something really internal.
|
|
process._eval = code;
|
|
|
|
const print = getOptionValue('--print');
|
|
if (getOptionValue('--input-type') === 'module')
|
|
evalModule(code, print);
|
|
else
|
|
evalScript('[stdin]',
|
|
code,
|
|
getOptionValue('--inspect-brk'),
|
|
print);
|
|
});
|