Skip to content

Commit

Permalink
Catch stat error
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x committed Jun 26, 2024
1 parent b3736e4 commit 545da7a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions manifest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { homedir, hostname } from 'node:os'
import { join } from 'node:path'
import { readdir, stat } from 'node:fs/promises'
import { start } from 'node:repl'

const host = hostname().toLowerCase()
const rxrc = 'node_modules/@rxrc'
Expand Down Expand Up @@ -234,8 +233,12 @@ export default async () => ({
const randomFile = async dir => {
const rootDir = join(targetRoot, dir)

const dirStat = await stat(rootDir)
if (!dirStat.isDirectory) return null
try {
const dirStat = await stat(rootDir)
if (!dirStat.isDirectory) return null
} catch {
return null
}

const files = await readdir(rootDir)
if (!files.length) return null
Expand Down

0 comments on commit 545da7a

Please sign in to comment.