Skip to content

Conversation

@chrisblossom
Copy link
Contributor

@chrisblossom chrisblossom commented Jul 8, 2019

Fixes #68.

I first solved it with the following code:

if (!dryRun) {
    try {
        await rimrafP(file, {glob: false});
    } catch (error) {
        if (error.code === 'EINVAL') {
            await rimrafP(file, {glob: false});
        } else {
            throw error;
        }
    }
}

If I should add this back as an additional fail-safe let me know.

@chrisblossom chrisblossom force-pushed the issue-68 branch 2 times, most recently from 0ea196a to 0fec11e Compare July 11, 2019 23:01
@sindresorhus
Copy link
Owner

Don't force push. It makes it harder for me to review as I can't see what was changed and you also overwrote a change I did. I will squash on merge anyway :)

@sindresorhus sindresorhus changed the title Sort file array prior to removing files Prevent race condition on macOS when deleting files Jul 12, 2019
@sindresorhus sindresorhus merged commit 8efdbcd into sindresorhus:master Jul 12, 2019
@sindresorhus
Copy link
Owner

Thanks for fixing this :)

@chrisblossom chrisblossom deleted the issue-68 branch July 12, 2019 18:12
@chrisblossom
Copy link
Contributor Author

Don't force push. It makes it harder for me to review as I can't see what was changed and you also overwrote a change I did. I will squash on merge anyway :)

My bad. I could have sworn I asked you about this recently what you prefer, but it was someone else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sometimes error "EINVAL" when removing files in macOS temp directory

2 participants