From 5890b9c4652608d67cd5fcb3abf3409aac29a44b Mon Sep 17 00:00:00 2001 From: Mario Pizzinini Date: Wed, 19 Oct 2016 15:45:20 +0200 Subject: [PATCH] Added try/catch block to .yarnclean write file operation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added try catch block to handle error „EEXIST: file already exists“. --- src/cli/commands/clean.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cli/commands/clean.js b/src/cli/commands/clean.js index 8f0ed67fc4..203b6e7d69 100644 --- a/src/cli/commands/clean.js +++ b/src/cli/commands/clean.js @@ -120,7 +120,9 @@ export async function run( args: Array, ): Promise { reporter.step(1, 2, reporter.lang('cleanCreatingFile', CLEAN_FILENAME)); - await fs.writeFile(path.join(config.cwd, CLEAN_FILENAME), '\n', {flag: 'wx'}); + try { + await fs.writeFile(path.join(config.cwd, CLEAN_FILENAME), '\n', {flag: 'wx'}); + } catch (e) {} reporter.step(2, 2, reporter.lang('cleaning')); const {removedFiles, removedSize} = await clean(config, reporter);