On Mon, Apr 23, 2012 at 12:34, Adam Spragg
<adam.spr...@octaltelecom.co.uk> wrote:
> I'm currently working on a system that passes javascript commands to node.js
> through a pipe.
>
> Node.js appears to buffer it's stdin under these circumstances, which is a
> problem as I'm wanting to send one command, wait a few seconds, send another,
> wait a bit more, send the next, etc... - but I want the first command to be
> executed as soon as it's received.
>
> To reproduce:
>
>  $ cat | node
>  setTimeout(function() { console.log('testing'); }, 10000);
>  console.log('start');
>  ^D
>  start
>  testing
>  $
>
> I can pause for as long as I like between the console.log(...) line and
> hitting ^D, but the 'start' never comes up until I do, and 'testing' doesn't
> appear until 10 seconds after that.
>
> Is there a command line switch I can use to get it to turn this buffering off?
> If not, where might I start looking through the code to patch my local copy
> myself? I found what looks like the main event loop
> "uv_run(uv_default_loop());" in node.cc:Node::Start(), but can't figure out
> where to look next from there.

Look for the _normalWrite() method in lib/readline.js

-- 
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to