Open Darker opened 6 years ago
I encountered this issue when trying to copy two batches of files at the same time:
// My promise wrapper function ncpAsync(src, dst, options) { return new Promise(function (resolve, reject) { ncp(src, dst, options, function (err) { if (err) { if (typeof err == "string") err = new Error(err); reject(err); } else resolve(); }) }); } const copyPromises = [ ncpAsync("./web/", "./release_package/web/", { filter: function (f) { const stat = fs.lstatSync(f); return stat.isDirectory() || f.endsWith(".html"); }, // This works transform: function (read, write) { read .pipe(stream.replace(/<script +type="module" +src="(\.\/)?main\.js" *>/ig, "<script type=\"text/javascript\" src=\"dozor.min.js\">")) .pipe(write); } }), ncpAsync("./web/", "./release_package/web/", { filter: function (f) { console.log(" COPY FILE: ", f); return !f.endsWith(".html"); } }), ]; try { await Promise.all(copyPromises); } catch (e) { console.log("Copy FAILED!"); throw e; }
The errors:
ERROR(0,0): Error : EEXIST: file already exists, mkdir '*CENSORED*\release_package\web\error' errno: -4075, code: 'EEXIST', syscall: 'mkdir', path: '*CENSORED*\\release_package\\web\\error' }, EXEC(0,0): Error : EEXIST: file already exists, mkdir '*CENSORED*\release_package\web\img' errno: -4075, code: 'EEXIST', syscall: 'mkdir', path: '*CENSORED*\\release_package\\web\\img' }, EXEC(0,0): Error : EEXIST: file already exists, mkdir '*CENSORED*\release_package\web\lib' errno: -4075, code: 'EEXIST', syscall: 'mkdir', path: '*CENSORED*\\release_package\\web\\lib' } ]
The copying only overlaps with the directories - otherwise both groups of files are different - HTML files are copied separately and transformed. Other files are not being transformed.
I encountered this issue when trying to copy two batches of files at the same time:
The errors:
The copying only overlaps with the directories - otherwise both groups of files are different - HTML files are copied separately and transformed. Other files are not being transformed.