Skip to content

Commit

Permalink
Added try/catch block to .yarnclean write file operation
Browse files Browse the repository at this point in the history
Added try catch block to handle error „EEXIST: file already exists“.
  • Loading branch information
craftedsystems authored and bestander committed Oct 19, 2016
1 parent d155ce8 commit 5890b9c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cli/commands/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ export async function run(
args: Array<string>,
): Promise<void> {
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);
Expand Down

0 comments on commit 5890b9c

Please sign in to comment.