Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if directories exist before removing during hoist #568

Merged
merged 1 commit into from
Feb 3, 2017

Conversation

gigabo
Copy link
Contributor

@gigabo gigabo commented Feb 2, 2017

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

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
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
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
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
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
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
Copy link

lock bot commented Dec 27, 2018

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.

None yet

4 participants