Skip to content

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

@maksis

Description

@maksis

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)) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions