• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3// Stdin is not a TTY, we will read it and execute it.
4
5const {
6  prepareMainThreadExecution
7} = require('internal/bootstrap/pre_execution');
8
9const { getOptionValue } = require('internal/options');
10
11const {
12  evalModule,
13  evalScript,
14  readStdin
15} = require('internal/process/execution');
16
17prepareMainThreadExecution();
18markBootstrapComplete();
19
20readStdin((code) => {
21  // This is necessary for fork() and CJS module compilation.
22  // TODO(joyeecheung): pass this with something really internal.
23  process._eval = code;
24
25  const print = getOptionValue('--print');
26  if (getOptionValue('--input-type') === 'module')
27    evalModule(code, print);
28  else
29    evalScript('[stdin]',
30               code,
31               getOptionValue('--inspect-brk'),
32               print);
33});
34