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

Error while creating daemon folder: daemon already exists #359

Open
kern3l-pan1c opened this issue Oct 19, 2023 · 1 comment
Open

Error while creating daemon folder: daemon already exists #359

kern3l-pan1c opened this issue Oct 19, 2023 · 1 comment

Comments

@kern3l-pan1c
Copy link

Issue:
On a fresh machine (where node-windows has never run before), if I initiate two or more installs (of different services) simultaneously, we see an intermittent issue where:

  1. For one or more installs, fs.exists (
    fs.exists(dir, function (exists) {
    ) does not find the daemon folder (because nod-windows has not been run yet and daemon folder is actually not there).
  2. Since fs.exists is async (also deprecated), all calls in step 1 will try to create the daemon folder.
  3. This leads to a collision where all the installs after the first one (whoever gets to create daemon folder) will fail with an error saying daemon folder already exists.

How To Reproduce:
Give multiple install commands simultaneously.

Expected Behavior:
daemon folder should be created without errors and services should get installed.

Desktop:

  • OS: Windows 11

Probable Fix:
We should be using the fs.existsSync function instead of fs.exists at

fs.exists(dir, function (exists) {

@coreybutler if you want, I can raise a PR with this fix

@kern3l-pan1c
Copy link
Author

@coreybutler I have created #360 with the fix

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

No branches or pull requests

1 participant