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