jprichardson/node-fs-extra — pull request #38 by ulikoehler (2013-10-22 00:33:07+00:00)
Title: Return err in copy() fstat cb, because stat could be undefined or null

I had a problem with FlyLaTeX, where some weird arguments (notexistent files etc) were passed to copy() --> err is ENOENT, but the copy() code failed to properly terminate the lstat callback when err is not false-ish, resulting in the whole application terminating with this error-code

```
/var/lib/nodejs/node-apps/flylatex/node_modules/fs-extra/lib/copy.js:41
if (stats.isDirectory()) {
```

This PR fixes this by not only calling *callback(err)* but instead returning it. I didn't check other functions or files for similar problems. Please feel free to comment if you think this should be fixed otherwise or see possible side-effects with this fix.