node.js readline - write data appears in input -


i've got basic readline implementation seems have problem when write written data appears in input , raises 'line' event. in standard linux rxvt window.

var rl  readline.createinterface({     input: process.stdin,     output: process.stdout, //    terminal: false   <--- setting true/false makes no difference });  rl.on('line', function(line) {     var inp = line.trim();     console.log('line event');     switch(inp) {         case   ....     default:        console.log('unknown command: ' + inp + '\n');     } }); 

and rl.write(string);

from socket i/o. write raises 'line' event , written data apears unknown command.

if enter data on terminal raises 'line' event expected , works ok.

clearly data written shouldn't appear on input , asking might reason this.

thanks

actually rl.write trigger line event. should in docs isn't. if want bypass parser write process.stdout.

previously terminal: false cause output have trailing endline, forcing line event trigger. give true avoid that, has been changed changing option won't help.

see raised issue. last comment says same.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -