Catch exceptions for bad package.json when looking for Atom repo in pwd

This commit is contained in:
David Wilson
2018-09-15 06:30:49 -07:00
parent e6507c59cb
commit b35778b686

View File

@@ -20,8 +20,12 @@ const args =
function isAtomRepoPath (repoPath) {
let packageJsonPath = path.join(repoPath, 'package.json')
if (fs.statSyncNoException(packageJsonPath)) {
let packageJson = CSON.readFileSync(packageJsonPath)
return packageJson.name === 'atom'
try {
let packageJson = CSON.readFileSync(packageJsonPath)
return packageJson.name === 'atom'
} catch (e) {
return false
}
}
return false