Skip to content

Commit d2e58e3

Browse files
Han5991Renegade334
andcommitted
fs: simplify getDirentSync lstatSync handling
Co-authored-by: René <contact.9a5d6388@renegade334.me.uk>
1 parent 1d288a6 commit d2e58e3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/internal/fs/glob.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,13 @@ async function getDirent(path) {
6565
* @returns {DirentFromStats|null}
6666
*/
6767
function getDirentSync(path) {
68+
let stat;
6869
try {
69-
const stat = lstatSync(path, { throwIfNoEntry: false });
70-
if (stat === undefined) {
71-
return null;
72-
}
73-
return new DirentFromStats(basename(path), stat, dirname(path));
70+
stat = lstatSync(path);
7471
} catch {
7572
return null;
7673
}
74+
return new DirentFromStats(basename(path), stat, dirname(path));
7775
}
7876

7977
/**

0 commit comments

Comments
 (0)