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

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