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

1 Answer 1

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.

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

Comments

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.