Comments (2)
Agreed. Passing an array of errors is poor Node.js convention. Anyway you would modify it to have the callback fire with the first encountered error?
from ncp.
The error is on line 198 in ncp.js in the onError handler
if (options.stopOnError) {
return callback(err);
}
else if (!errs && options.errs) {
errs = fs.createWriteStream(options.errs);
}
else if (!errs) {
errs = [];
}
else if (options.errs) { // this is the problem
if (typeof errs.write === 'undefined') {
errs.push(err);
}
else {
errs.write(err.stack + '\n\n');
}
}
return cb();
This logic doesn't work properly and the options used there are undocumented. However, its clear that
else if (options.errs) {
is incorrect - it means that if an errs option is not provided, no errors will ever be pushed into the errs array.
To fix this, line 198 should be simply removed, along with its closing brace. Its not necessary to check for anything there - the errs array (or stream) is already defined and errors can be pushed (or written) to it.
from ncp.
Related Issues (20)
- Filter not working as expected HOT 1
- There is no `--dereference` option
- error in useage for options
- EEXIST: file already exists, mkdir
- Callback is triggered even if not finished HOT 2
- Can`t copy simlink on mounted windows samba shares.
- Filter is not working HOT 4
- callback not called HOT 2
- Add options for copy HOT 1
- Copy files recursively to the destination in Windows creating unwanted folders HOT 12
- How to apply filter on files only?
- silence mode
- Audit vulnerabilities detected in the ncp project on Tag: v2.0.0
- Race condition when 2 calls copying files to the same nonexistent directory
- Race condition when 2 calls copying files to the same directory
- Callback is called before file is copied
- Race condition when 2 calls copying files to the same path
- Another race condition when 2 calls copying files to the same path
- Add vars
- Filter does not work in CLI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ncp.