Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Fix for node 0.10: use setImmediate() #22

merged 2 commits into from

2 participants


In node 0.10 using recursive process.nextTick() calls breaks ('resulting in a maximum call stack size exceeded'). Use setImmediate() instead.


If/when landing this, please cherry-pick it onto a new 0.2.x tag so that fs-extra will take the fix in without a new version/publish. Thanks! ;)


While your change is the correct one, it needs to remain backwards-compatible, and still use process.nextTick for all pre-0.9 versions of node. I've been meaning to make this change for a while, but haven't had the chance.

If you've got the time to add a version check and a fallback for 0.8, I'll merge it presently; otherwise, I'll add it later today myself.

Thanks, regardless!


@AvianFlu Ah right, done.


Awesome! Since it's backwards-compatible, a new 0.2.x it is. Merging presently.



Thanks a lot :)


Actually, I haven't looked at my own versions in a while... I'm up to 0.4.0. I'd love to help you guys out with your dependency needs, but it seems like a strange release to make at this point.


@AvianFlu AvianFlu merged commit c1de4d6 into AvianFlu:master

Nevermind, it took my brain a little while to catch up to what you were asking for with the 0.2.x release above. Long day. Cherry-picking presently.


@kschzt 0.2.7 published. Thanks again for the fix, guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 12, 2013
  1. fallback to nextTick if setImmediate is not a function

    Jaakko Manninen authored
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/ncp.js
8 lib/ncp.js
@@ -43,9 +43,15 @@ function ncp (source, dest, options, callback) {
return getStats(source);
+ function defer(fn) {
+ if (typeof(setImmediate) === 'function')
+ return setImmediate(fn);
+ return process.nextTick(fn);
+ }
function getStats(source) {
if (running >= limit) {
- return process.nextTick(function () {
+ return defer(function () {
Something went wrong with that request. Please try again.