0

So I am using node.js' built-in debugger and trying to skip the "break on first line" that it performs by passing in a delayed "c" keypress (c=continue) using echo, as such:

(sleep 1; echo -ne 'c\n') | node debug ~/src/main.js

It works as expected, but the node debugger no longer seems to accept keyboard input afterwords. I assume the piping in bash is doing something to cause node to ignore the keyboard. Anyone know how I can achieve the same result but maintain keyboard input to the node program?

  • 1
    Perhaps this will be helpful: http://stackoverflow.com/questions/16420374/how-to-disable-in-the-node-debugger-break-on-first-line – Jordan Running Oct 20 '14 at 22:32

1 Answers1

1

Because node is being run in a pipeline, its input file descriptor is open to the pipeline, not to the console.

A common way to feed input to a process and then allow the user to interact is to use expect or pexpect.

tripleee
  • 175,061
  • 34
  • 275
  • 318