Merge pull request #18060 from atom/dw-catch-json-exception

Catch exceptions for bad package.json when looking for Atom repo in pwd
This commit is contained in:
David Wilson 2018-09-15 07:51:45 -07:00 committed by GitHub
commit 699db30920
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

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