Be explicit about second flag

This commit is contained in:
Bryan Clark 2019-12-06 14:28:34 -05:00
parent 5e29577d7b
commit 8940139ee8
1 changed files with 2 additions and 3 deletions

View File

@ -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;
}