fix: handle errors in file stat retrieval to prevent crashes

This commit is contained in:
purocean
2024-11-08 17:26:45 +08:00
parent 17ca5de28f
commit 30d5ab77dd
+8 -1
View File
@@ -296,7 +296,14 @@ async function travels (
await Promise.all(list.map(async name => {
const p = path.join(location, name)
const stat = await fs.stat(p)
const stat = await fs.stat(p).catch(e => {
console.error('travels', p, e)
return null
})
if (!stat) {
return
}
if (stat.isFile()) {
if (excludeRegex.test(name)) {