Skip to content

Commit

Permalink
Be explicit about second flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Clark committed Dec 6, 2019
1 parent 5e29577 commit 8940139
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ async function write(directory: string, settings: string) {
return fs.writeFileSync(location, settings, options);
} catch (e) {
if (e.code == "EEXIST") {
console.log(`overwriting existing file ${location}`);
// default flag is 'w'
return fs.writeFileSync(location, settings, {encoding: 'utf-8'});
console.warn(`overwriting existing file ${location}`);
return fs.writeFileSync(location, settings, {encoding: 'utf-8', flag: 'w'});
}
throw e;
}
Expand Down

0 comments on commit 8940139

Please sign in to comment.