'add' event does not fire when watching a UNIX domain socket on macOS
Describe the bug
The add event does not get triggered when watching a single UNIX socket. It works for regular files and also works when globbing, so I suspect this is a bug.
Versions:
- Chokidar version 3.0.2
- Node version v12.4.0
- OS version: macOS 10.14.5
To Reproduce
Make sure not to use globbing, and just open up a regular UNIX domain socket.
var chokidar = require('chokidar');
var net = require('net');
// One-liner for files and directories starting with 'test'
chokidar.watch('test.sock', {}).on('all', (event, path) => {
console.log(event, path);
});
const server = net.createServer();
server.listen('test.sock');
// Does not output anything, while we'd expect it to output a single 'add' event
Expected behavior
For the previous piece of code to just work. That is, for it to register the newly created socket.
Additional context
I'm creating a small auto-configuring process manager, and I'd like to use this trick to only bind to the socket when it is actually there.
FWIW, I discovered this same bug in a Rust library that uses FSNotify under the hood. Assuming this library uses FSNotify as well, I think there is a bug in FSNotify itself that does not detect UNIX domain sockets. I replicated the issue using the raw C API and opened a bug with Apple