6

I have this simple program:

process.stdin.once("data", function (data) {
    console.log("You said your name is " + data);
    process.stdin.pause();
});
console.log("What is your name?");
process.stdin.resume();

Now I put a breakpoint inside a callback:

enter image description here

And run the program, the console tab is open:

enter image description here

But whatever I type into the terminal in this console tab doesn't trigger a breakpoint. It seems that this console tab is not a terminal used to accept input from a user.

1
  • 1
    I googled how to turn off this stupid feature for 30 minutes....thanks Commented Nov 13, 2017 at 20:44

1 Answer 1

5

While debugging, make sure that "Use Console Input" toggle button on console's toolbar is NOT pressed - when it's pressed, console is in 'live' mode, all entered expressions are evaluated, so stdin is disabled.

enter image description here

Sign up to request clarification or add additional context in comments.

4 Comments

yes, that was it, thanks a lot! You're saying all entered expressions are evaluated - what scope is used? Because, for example, the function require is not available, in this env, but encodeURI is available
it's current execution scope - same as used when evaluating expressions in debugger
I don't understand why global require is not available. Or is it an execution context of a standalone v8 engine without app specific functions?
hm, I created another question to debug it. Can you please take a look?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.