Stop readline Writing Input to the Output

610 views
Skip to first unread message

Volkan Yazıcı

unread,
Oct 14, 2012, 2:44:43 PM10/14/12
to nod...@googlegroups.com
How can I make readline stop writing the read input to the output? That is, when I do

lines = [];
var rl = readline.createInterface(process.stdin, process.stdout);
rl.resume()
rl.on("line", function (line) {
    lines.push(line);
});

read lines get written to the output as well. I would like to shut that behaviour down. Any ideas?

Alex Kocharin

unread,
Oct 14, 2012, 3:15:51 PM10/14/12
to nod...@googlegroups.com
Replace process.stdout with a custom stream?
--
// alex
 
 
14.10.2012, 22:44, "Volkan Yazıcı" <volkan...@gmail.com>:
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Volkan Yazıcı

unread,
Oct 14, 2012, 3:18:15 PM10/14/12
to nod...@googlegroups.com, al...@kocharin.ru
Yeah, I can make it point to /dev/null, but isn't there a better way of doing this?

Martin Cooper

unread,
Oct 14, 2012, 5:04:53 PM10/14/12
to nod...@googlegroups.com
On Sun, Oct 14, 2012 at 12:18 PM, Volkan Yazıcı <volkan...@gmail.com> wrote:
> Yeah, I can make it point to /dev/null, but isn't there a better way of
> doing this?

The output stream is required with 'readline', so you have to give it
something. Depending on your use case, you can probably do what you
want by using 'read' instead:

https://github.com/isaacs/read

--
Martin Cooper


> On Sunday, October 14, 2012 10:16:11 PM UTC+3, Alex Kocharin wrote:
>>
>> Replace process.stdout with a custom stream?
>
>
>
Reply all
Reply to author
Forward
0 new messages