Merge pull request #15656 from atom/aw-extra-write-guard

Restore the fs.existsSync guard in Config
This commit is contained in:
Ash Wilson
2017-09-14 21:58:27 -04:00
committed by GitHub

View File

@@ -867,8 +867,9 @@ class Config
return if @savePending
try
fs.makeTreeSync(path.dirname(@configFilePath))
CSON.writeFileSync(@configFilePath, {}, {flag: 'wx'}) # fails if file exists
unless fs.existsSync(@configFilePath)
fs.makeTreeSync(path.dirname(@configFilePath))
CSON.writeFileSync(@configFilePath, {}, {flag: 'wx'}) # fails if file exists
catch error
if error.code isnt 'EEXIST'
@configFileHasErrors = true