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

Crash when trying to watch a non-existing network name on Windows #132

Open
maksis opened this issue Oct 25, 2024 · 1 comment
Open

Crash when trying to watch a non-existing network name on Windows #132

maksis opened this issue Oct 25, 2024 · 1 comment

Comments

@maksis
Copy link

maksis commented Oct 25, 2024

I'm trying to watch a non-existing network name (\\INVALID\Directory\) and the application crashes with the following stack trace:

Error: \\INVALID\Directory\ does not exist.
    at webpack:\airdcpp-share-monitor\node_modules\node-watch\lib\watch.js:494:1
    at processTicksAndRejections (node:internal/process/task_queues:85:11)

I checked that fs.stat in is.file

if (is.file(fpath)) {

throws the following error so the error emitter method is never being exposed:

code = 'UNKNOWN'
errno =-4094
path = '\\\\INVALID\\Folder\\'
syscall ='stat'
message = "UNKNOWN: unknown error, stat '\\\\INVALID\\Folder\\'"

I couldn't figure out that why checkStat only handles certain error codes safely and crashes the app on others.

if (/^(ENOENT|EPERM|EACCES)$/.test(err.code)) {

@maksis
Copy link
Author

maksis commented Oct 25, 2024

I believe that the crash was avoided before e226156 since I had the watch call inside a try..catch block but it no longer helps when process.nextTick is present

maksis added a commit to airdcpp-web/airdcpp-share-monitor that referenced this issue Oct 26, 2024
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