Skip to content

Commit

Permalink
code == EEXIST
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Clark committed Dec 5, 2019
1 parent 948db75 commit 7970453
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ async function write(directory: string, settings: string) {
try {
return fs.writeFileSync(location, settings, options);
} catch (e) {
if (e.code == fs.constants.O_EXCL) {
if (e.code == "EEXIST") {
console.log(`overwriting existing file ${location}`);
// default flag is 'w'
return fs.writeFileSync(location, settings, {encoding: 'utf-8'});
}
console.log(`error ${JSON.stringify(e)} and O_EXCL ${fs.constants.O_EXCL}`);
throw e;
}
}

0 comments on commit 7970453

Please sign in to comment.