Initially I tried to set raw mode using tty.setRawMode(true) the log told me that was deprecated and I should be using process.stdin.setRawMode(true) but that command is giving me TypeError: Object #<Socket> has no method 'setRawMode' I cant seem to find much else in the way of raw mode documentation that suggests any other apporoaches anyone know how to get this working?
I am using version 0.10.25
It works wonderfully via node server.js but nodemon server.js gives me TypeError: process.stdin.setRawMode is not a function error and the server aborts.
Since nodemon is also waiting for keys to be pressed (i.e. "rs" to restart server), we're running into a conflict because nodemon has commandeered process.stdin.
To workaround the issue, I added a config.ini directive named nodemonMode=yes|no. If it is set to yes, then I skip the offending section of code with the process.stdin.setRawMode(true) code in it. I bet there's is even a simpler way to determine if you're running nodemon.
So it turns out nodemon uses child_process, because of this writing process.stdin.setRawMode(true); in a script that you then run with nodemon will result in TypeError: Object #<Socket> has no method 'setRawMode'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With