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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -