Commit 79704535 authored by Bryan Clark's avatar Bryan Clark
Browse files

code == EEXIST

parent 948db758
Loading
Loading
Loading
Loading

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

+1 −2
Changes for src/auth.ts: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -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;
  }
}