allowed for specifying not-yet-existent config file

This commit is contained in:
tigerbot 2017-06-12 11:38:18 -06:00
parent 78c1fb344e
commit 4d49e0fb63
1 changed files with 11 additions and 1 deletions

View File

@ -87,7 +87,17 @@ function checkConfigLocation(cwd, configFile) {
var prom; var prom;
if (configFile) { if (configFile) {
filename = path.resolve(cwd, configFile); filename = path.resolve(cwd, configFile);
prom = fs.readFileAsync(filename); prom = fs.readFileAsync(filename)
.catch(function (err) {
if (err.code !== 'ENOENT') {
return PromiseA.reject(err);
}
if (path.extname(filename) === '.json') {
return '{}';
}
return '';
})
;
} else { } else {
prom = PromiseA.reject('blah') prom = PromiseA.reject('blah')
.catch(function () { .catch(function () {