Skip to content

Commit

Permalink
Merge pull request #209 from poshta1900/fix
Browse files Browse the repository at this point in the history
add try-catch around fs.writeSync
  • Loading branch information
cthackers authored May 12, 2018
2 parents b94c5dd + ef0abe6 commit 39c83a2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,15 @@ module.exports = (function() {
fd = fs.openSync(path, 'w', 438);
}
if (fd) {
fs.writeSync(fd, content, 0, content.length, 0);
fs.closeSync(fd);
try {
fs.writeSync(fd, content, 0, content.length, 0);
}
catch (e){
throw e;
}
finally {
fs.closeSync(fd);
}
}
fs.chmodSync(path, attr || 438);
return true;
Expand Down

0 comments on commit 39c83a2

Please sign in to comment.