mirror of
https://github.com/nodejs/node.git
synced 2025-05-09 06:51:42 +00:00

New flag is for string input only PR-URL: https://github.com/nodejs/node/pull/27184 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Myles Borins <myles.borins@gmail.com>
25 lines
540 B
JavaScript
25 lines
540 B
JavaScript
'use strict';
|
|
|
|
// Stdin is not a TTY, we will read it and execute it.
|
|
|
|
const {
|
|
prepareMainThreadExecution
|
|
} = require('internal/bootstrap/pre_execution');
|
|
|
|
const {
|
|
evalModule,
|
|
evalScript,
|
|
readStdin
|
|
} = require('internal/process/execution');
|
|
|
|
prepareMainThreadExecution();
|
|
markBootstrapComplete();
|
|
|
|
readStdin((code) => {
|
|
process._eval = code;
|
|
if (require('internal/options').getOptionValue('--input-type') === 'module')
|
|
evalModule(process._eval);
|
|
else
|
|
evalScript('[stdin]', process._eval, process._breakFirstLine);
|
|
});
|