From 797045350f7883bf56a4ec7728e71f079f9676d9 Mon Sep 17 00:00:00 2001 From: Bryan Clark Date: Thu, 5 Dec 2019 00:54:26 -0500 Subject: [PATCH] code == EEXIST --- dist/index.js | 3 +-- src/auth.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 0ff2524..92274cd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4170,12 +4170,11 @@ function write(directory, settings) { 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; } }); diff --git a/src/auth.ts b/src/auth.ts index f716261..6068341 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -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; } }