Made nodejs a part of my build system where I use it to go through
the .js files to extract some information. I print a bunch of
information out via sys.puts() but it seems that it sometimes get an
empty file. It looks like nodejs tries hard to have the stdout
nonblocking, but doesn't wait for the stdout to be written before
exit. I had a look at where i could just add
fflush(fdopen(STDOUT_FILENO)) but realized that there are some
couplings made and that it would not have the right effect on every
platform I can test on.
Could somebody have a look at the code and unset the O_NONBLOCK and
fflush stdout appropriately before quitting? Here is a code that does
such a thing http://www.meme.com/soft/pushprog.c but that doesn't
involve the couplings nodejs contains which confused me.
Cheers!
Standa
PS: I worked around the problem by writing the contents into a file
explicitly which works fine for me for the time being...
Please move this to a new thread, rather then changing the topic on an existing thread.
Thanks,
Micheil Smith
BrandedCode.com
> signature.asc
> < 1KViewDownload
- Micheil.
> --
> 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.
>
It is, but that isn't the issue here (as far as I can tell from the
authors posting). While that would solve the problem, the issue is
that the program will exit completely before all its output has been
written.
I have ran into this problem as well while using
process.createChildProcess(). The child will get the exit event
before that last data has been written to stdout from the child.
Even if the sys.puts is async, it seems useful to me that if you do
write something to stdout that it at least be guaranteed to be
written.
This is an essential feature of a well behaving application to
actually provide all stdout written data. If that were not the case it
would be unusable in typical unixy way, piping from one process to
another through the stdout/stdin channel.
Best Regards
Standa
On Feb 5, 4:39 pm, Tim Caswell <t...@creationix.com> wrote:
> Correct, that's the behavior I see all the time too. About 20% of the time my programs will not output the last chunk of data to the terminal before they close. It's simply been an annoyance to me, but I would like to see it fixed somehow.
>
> On Feb 5, 2010, at 7:48 AM, Benjamin Thomas wrote:
>