node.js readline - write data appears in input

I've got a very basic readline implementation which seems to have a problem that when I write the written data appears in input and raises a 'line' event. This is all in a 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 then rl.write(string);

from socket i/o. The write raises 'line' event and the written data apears as an unknown command.

If I enter data on terminal it raises 'line' event as expected and works OK.

Clearly data written shouldn't appear on input and asking what might be the reason for this.

Thanks

Actually rl.write will trigger line event. It should be in the docs but it isn't. If you want to bypass the parser simply write to process.stdout.

Previously terminal: false would cause output to have a trailing endline, forcing line event trigger. So you could give it true to avoid that, but now it has been changed so changing option won't help.

See the raised issue. Last comment says the same.