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

Strange behavior with 'use strict' #1619

Open
th3r0b0t opened this issue Nov 18, 2024 · 0 comments
Open

Strange behavior with 'use strict' #1619

th3r0b0t opened this issue Nov 18, 2024 · 0 comments

Comments

@th3r0b0t
Copy link

th3r0b0t commented Nov 18, 2024

Good day,
I made an addon, and when I have a index.js file inside its root directory; when I run this file to test the bindings, it works fine, but when I copy paste the addon directory to my project and require its index.js file (which its first line is 'use strict' as per examples and simply require the addon .node file and re-export it) to call its constructor (it is a context-aware addon) it crashes with an exception that has Tkrzw exception type (Tkrzw is the name of the library I'm trying to make binding for) which means constructor begins to run but then it crashes! Also before it crashes, it creates a file (which this constructor is expected to do)!
What is strange about it, is that if I run the index.js file in my addon root directory once, it no longer crashes anymore!
Then I deleted the entire project, cloned my project again, cloned my addon again and placed it again, but this time I removed 'use strict' from the top of my index.js file and it works the first time without running index.js file first!
I tested this multiple times and it was keep crashing until I figured what causes the problem!


The error it gives is: opendir: no such file (It might say it a little different I don't remember exact words but it starts with opendir: and says it cant find the file).


P.S: You can find the addon source code here: https://github.com/th3r0b0t/tkrzw-node
P.S2: Ofc I comment out everything in index.js file except for the first 3 lines: 'use strict', bindings(...) and re-export

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Need Triage
Development

No branches or pull requests

1 participant