I am running a node server daemon but I keep running into this error.
When I run my bash strip to test the application I get TypeError: process.stdin.setRawMode is not a function
.
Can you help me find a way I can use keyboard input with this node application running in the background?
I have tried giving my bash script permissions chmod 777 x.sh
& chmod 755 x.sh
setRawMode()
is only available when the input is provided by a TTY and not like yours as direct stream from stdin
.
Use this to check what stream you have:
if (process.stdin.isTTY) {
process.stdin.setRawMode(true);
}