From f032a58514f0b89dce91d06fc17e94e8204aa555 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Tue, 20 Jun 2023 13:03:46 +0200 Subject: [PATCH] emit error if one of the main entries is missing --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index ae0f79b..af07a24 100644 --- a/index.js +++ b/index.js @@ -326,7 +326,8 @@ function normalize (name) { } function statAll (fs, stat, cwd, ignore, entries, sort) { - const queue = (entries || ['.']).slice(0) + if (!entries) entries = ['.'] + const queue = entries.slice(0) return function loop (callback) { if (!queue.length) return callback(null) @@ -336,7 +337,7 @@ function statAll (fs, stat, cwd, ignore, entries, sort) { stat.call(fs, nextAbs, function (err, stat) { // ignore errors if the files were deleted while buffering - if (err) return callback(err.code === 'ENOENT' ? null : err) + if (err) return callback(entries.indexOf(next) === -1 && err.code === 'ENOENT' ? null : err) if (!stat.isDirectory()) return callback(null, next, stat)