Merge pull request #1701 from thelounge/xpaw/sync-write

Go back to writing user files synchronously
This commit is contained in:
Jérémie Astori 2017-11-11 19:24:28 -05:00 committed by GitHub
commit 1e7b398903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,15 +140,12 @@ ClientManager.prototype.updateUser = function(name, opts, callback) {
return callback ? callback() : true; return callback ? callback() : true;
} }
fs.writeFile(Helper.getUserConfigPath(name), newUser, (err) => { try {
if (err) { fs.writeFileSync(Helper.getUserConfigPath(name), newUser);
log.error(`Failed to update user ${colors.green(name)}. (${err})`); } catch (e) {
log.error(`Failed to update user ${colors.green(name)} (${e})`);
throw e;
} }
if (callback) {
callback(err);
}
});
}; };
ClientManager.prototype.removeUser = function(name) { ClientManager.prototype.removeUser = function(name) {