Merge pull request #923 from DetachHead/dev

This commit is contained in:
Surma
2021-01-05 12:51:59 +00:00
committed by GitHub

View File

@@ -183,31 +183,36 @@ function progressTracker(results) {
return tracker; return tracker;
} }
async function checkInputFilesValid(files) { async function getInputFiles(paths) {
const validFiles = []; const validFiles = [];
for (const file of files) { for (const path of paths) {
try { const files = (await fsp.lstat(path)).isDirectory()
await fsp.stat(file); ? (await fsp.readdir(path)).map(file => join(path, file))
} catch (err) { : [path];
if (err.code === 'ENOENT') { for (const file of files) {
console.warn( try {
`Warning: Input file does not exist: ${resolvePath(file)}`, await fsp.stat(file);
); } catch (err) {
continue; if (err.code === 'ENOENT') {
} else { console.warn(
throw err; `Warning: Input file does not exist: ${resolvePath(file)}`,
);
continue;
} else {
throw err;
}
} }
}
validFiles.push(file); validFiles.push(file);
}
} }
return validFiles; return validFiles;
} }
async function processFiles(files) { async function processFiles(files) {
files = await checkInputFilesValid(files); files = await getInputFiles(files);
const parallelism = cpus().length; const parallelism = cpus().length;