Currently, Node.js is hacked to never read from stdin:
|
if (true) { |
|
// TODO (cf): This should only happen if we run node via node::lib::Initialize(). |
|
// It should not run if we call node::lib::Start(). |
|
|
|
// Do nothing. Calling evalScript is necessary however, because it sets |
|
// globals.require to the require function. |
|
// Otherwise, require doesn't work. |
|
console.log('Embedded mode'); |
|
evalScript('[eval]'); |
|
// If -i or --interactive were passed, or stdin is a TTY. |
|
} else if (process._forceRepl || NativeModule.require('tty').isatty(0)) { |
Add a command line parameter (?) to toggle this behaviour.
Currently, Node.js is hacked to never read from stdin:
node/lib/internal/bootstrap_node.js
Lines 200 to 210 in 734d0d6
Add a command line parameter (?) to toggle this behaviour.