Skip to content

Commit 5984a0d

Browse files
committed
fix(ui): bail access denied folders
1 parent 60de7c4 commit 5984a0d

File tree

1 file changed

+16
-2
lines changed
  • packages/@vue/cli-ui/src/graphql-api/connectors

1 file changed

+16
-2
lines changed

packages/@vue/cli-ui/src/graphql-api/connectors/folders.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ const pkgCache = new LRU({
99

1010
const cwd = require('./cwd')
1111

12+
function isDirectory (file) {
13+
try {
14+
return fs.statSync(file.path).isDirectory()
15+
} catch (e) {
16+
console.warn(e.message)
17+
}
18+
return false
19+
}
20+
1221
async function list (base, context) {
1322
const files = await fs.readdir(base, 'utf8')
1423
return files.map(
@@ -17,7 +26,7 @@ async function list (base, context) {
1726
name: file
1827
})
1928
).filter(
20-
file => fs.statSync(file.path).isDirectory()
29+
file => isDirectory(file)
2130
)
2231
}
2332

@@ -46,7 +55,12 @@ function openParent (file, context) {
4655
}
4756

4857
function isPackage (file, context) {
49-
return fs.existsSync(path.join(file, 'package.json'))
58+
try {
59+
return fs.existsSync(path.join(file, 'package.json'))
60+
} catch (e) {
61+
console.warn(e.message)
62+
}
63+
return false
5064
}
5165

5266
function readPackage (file, context, force = false) {

0 commit comments

Comments
 (0)