A non-zero exit with flushing can be achieved by deregistering all callbacks in the main event loop and registering a callback on the application exit event which calls exit with the exit code.
An exitWithBufferFlush method shouldn't be too difficult to write.
Laurant, I really appreciate the idiomatic direction on this.
- Brian
On May 13, 2010 9:43 AM, "Brian Takita" <brian....@gmail.com> wrote:
Thanks for the tip Laurent. The only reason why I ask is I may want to
have a non-zero exit code and would want to guarantee that the buffers
are flushed in that case. Also, it's typical to use exit when forking
processes (though node does not support forking but may in the
future).
Note that exceptions in the main event loop also cause this behavior.
Ryah, mentioned in the ticket that stderr should be flushed in that
case, which I agree with. I'd also argue that stdout should also be
flushed. I couldn't find any hooks (other than setTimeout) in the
event loop to accomplish this.
On Thu, May 13, 2010 at 9:18 AM, Debacker <deba...@gmail.com> wrote: > You are not expected to cal...