Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions js/spec/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,39 @@ describe('Node Sentinel File Watcher', function() {
watch = null;
}
});

it('supports watching unicode directories and uncode files', async function() {
const file = 'は.starts_with_unicode';
let eventFound = false;

function findEvent(element) {
if (
element.action === nsfw.actions.CREATED &&
element.directory === watchPath &&
element.file === file
) {
eventFound = true;
}
}

let watch = await nsfw(
workDir,
events => events.forEach(findEvent),
{ debounceMS: DEBOUNCE }
);

try {
await watch.start();
await sleep(TIMEOUT_PER_STEP);
await fse.writeFile(path.join(watchPath, file), 'Unicode though.');
await sleep(TIMEOUT_PER_STEP);

assert.ok(eventFound);
} finally {
await watch.stop();
watch = null;
}
});
});

describe('Garbage collection', function() {
Expand Down
4 changes: 0 additions & 4 deletions src/linux/InotifyEventLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ void InotifyEventLoop::work() {
isDirectoryRemoval = event->mask & (uint32_t)(IN_IGNORED | IN_DELETE_SELF);
isDirectoryEvent = event->mask & (uint32_t)(IN_ISDIR);

if (!isDirectoryRemoval && *event->name <= 31) {
continue;
}

if (event->mask & (uint32_t)(IN_ATTRIB | IN_MODIFY)) {
modify();
} else if (event->mask & (uint32_t)IN_CREATE) {
Expand Down