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

electron mocha temp dir locked; unlink error #77

Closed
grantfree035 opened this issue Aug 18, 2016 · 2 comments · Fixed by #78
Closed

electron mocha temp dir locked; unlink error #77

grantfree035 opened this issue Aug 18, 2016 · 2 comments · Fixed by #78

Comments

@grantfree035
Copy link

grantfree035 commented Aug 18, 2016

Environment:

  • electron-mocha: 3.0.4
  • electron-prebuilt: 1.3.3
  • OS: Windows 7 x64

I am receiving and unlink error as the test is exiting.
$ electron-mocha ./build/mocha.js --renderer

Here is the output at the end of the test:

{ Error: EBUSY: resource busy or locked, unlink 'C:\Users\ADMINI~1\AppData\Local\Temp\electron-mocha-FINsw6\Cookies'
    at Error (native)
    at Object.fs.unlinkSync (fs.js:1099:18)
    at rimrafSync (C:\Users\***\Desktop\***\node_modules\rimraf\rimraf.js:295:17)
    at C:\Users\***\Desktop\***\node_modules\rimraf\rimraf.js:330:5
    at Array.forEach (native)
    at rmkidsSync (C:\Users\***\Desktop\***\node_modules\rimraf\rimraf.js:329:26)
    at rmdirSync (C:\Users\***\Desktop\***\node_modules\rimraf\rimraf.js:322:7)
    at Function.rimrafSync [as sync] (C:\Users\***\Desktop\***\node_modules\rimraf\rimraf.js:293:9)
    at Object.removeSync (C:\Users\***\Desktop\***\node_modules\fs-extra\lib\remove\index.js:4:17)
    at App.app.on (C:\Users\***\Desktop\***\node_modules\electron-mocha\index.js:28:6)
  errno: -4082,
  code: 'EBUSY',
  syscall: 'unlink',
  path: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\electron-mocha-FINsw6\\Cookies'
}

I previously was using electron-mocha 2.1.0 without errors so I'm not sure which version is the culprit (unless the culprit is me being a gumby)

I've seen this unlink issue was before and remembered that it was resolved in 1.2.0 but it seemed to have popped up again.
I know for main processes you have to explicitly exit but I'm under the assumption the renderer processes will exit on their own.

@inukshuk
Copy link
Collaborator

inukshuk commented Aug 18, 2016

Are you testing any code that might be opening windows (even when they're not visible)?

We had to change force closing windows for multiple reasons (e.g., see #60 for context); open windows are the main reason I've seen for Windows failing when removing the temp dir.

@grantfree035
Copy link
Author

@inukshuk I found the culprit. I am using a module called app-root-path,, which lets me require from the root directory.

After skimming through their commits I found they have to adjust their search method by using an electron remote object. Commit Reference

After reading through electron API, I'm thinking that the modules code this is causing binding issues with the main process.

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 a pull request may close this issue.

2 participants