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

Do not throw on race-condition when creating client JS directory #1966

Merged
merged 1 commit into from Sep 21, 2021

Conversation

evantahler
Copy link
Member

Closes #1965

This PR use fs.mkdirSync(path, { recursive: true }); to not throw if there was a race condition with 2 actionhero processes trying to create the client js lib's directory at the same time. This was likely to happen in fast tests.

$ node
Welcome to Node.js v16.6.1.
Type ".help" for more information.

> const fs = require('fs')
undefined
> fs.mkdirSync('/tmp/foo')
undefined
> fs.mkdirSync('/tmp/foo')
Uncaught Error: EEXIST: file already exists, mkdir '/tmp/foo'
    at Object.mkdirSync (node:fs:1324:3) {
  errno: -17,
  syscall: 'mkdir',
  code: 'EEXIST',
  path: '/tmp/foo'
}
> fs.mkdirSync('/tmp/foo', {recursive: true})
undefined

@evantahler evantahler enabled auto-merge (squash) September 21, 2021 01:02
@evantahler evantahler merged commit 44b9a83 into main Sep 21, 2021
@evantahler evantahler deleted the client-js-write-error branch September 21, 2021 01:02
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.

Cannot overwrite client JS in tests
1 participant