Skip to content

Check if directories exist before removing during hoist - #568

Merged
hzoo merged 1 commit into
lerna:masterfrom
gigabo:hoist-rimraf
Feb 3, 2017
Merged

hzoo merged 1 commit into
lerna:masterfrom
gigabo:hoist-rimraf

Conversation

@gigabo

@gigabo gigabo commented Feb 2, 2017

Copy link
Copy Markdown
Contributor

These noop rimrafs were cheap before #547, but they're expensive now.

Comment thread src/commands/BootstrapCommand.js Outdated
FileSystemUtilities.rimraf(path.join(dir, name), cb);
const filePath = path.join(dir, name);
if (!FileSystemUtilities.existsSync(filePath)) return cb();
FileSystemUtilities.rimraf(filePath, cb);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: as the same might happen in other places, would it be more reasonable to let FileSystemUtilities.rimraf handle the case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that might be cleaner. Will be an unnecessary stat in most cases, but that's cheap.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, i'd probably file a bug against rimraf as it claims to be an equivalent to rm -rf and it's not because -f makes rm to swallow the error while rimraf fails.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not that it fails, it's just slow compared to calling rimraf in-process.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it, thx!

These noop rimrafs were cheap before lerna#547, but they're expensive now.
@hzoo
hzoo merged commit 6d92d2b into lerna:master Feb 3, 2017
@lock

lock Bot commented Dec 27, 2018

Copy link
Copy Markdown

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants