chore: use kqueue backend of notify on macOS (#21028)

Towards #20996 

"macos_fsevent" feature of notify links us to CoreFoundation on macOS.
This commit is contained in:
Divy Srivastava 2023-10-31 09:43:04 -07:00 committed by GitHub
parent e4308aebc0
commit 646afdf259
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 40 deletions

42
Cargo.lock generated
View file

@ -725,11 +725,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e"
dependencies = [
"cfg-if 0.1.10",
"crossbeam-channel 0.4.4",
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-epoch",
"crossbeam-queue",
"crossbeam-utils 0.7.2",
"crossbeam-utils",
]
[[package]]
@ -738,20 +738,10 @@ version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
dependencies = [
"crossbeam-utils 0.7.2",
"crossbeam-utils",
"maybe-uninit",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils 0.8.16",
]
[[package]]
name = "crossbeam-deque"
version = "0.7.4"
@ -759,7 +749,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils 0.7.2",
"crossbeam-utils",
"maybe-uninit",
]
@ -771,7 +761,7 @@ checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
dependencies = [
"autocfg",
"cfg-if 0.1.10",
"crossbeam-utils 0.7.2",
"crossbeam-utils",
"lazy_static",
"maybe-uninit",
"memoffset 0.5.6",
@ -785,7 +775,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
dependencies = [
"cfg-if 0.1.10",
"crossbeam-utils 0.7.2",
"crossbeam-utils",
"maybe-uninit",
]
@ -800,15 +790,6 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "crunchy"
version = "0.2.2"
@ -2486,15 +2467,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "fsevent-sys"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2"
dependencies = [
"libc",
]
[[package]]
name = "fslock"
version = "0.1.8"
@ -3513,9 +3485,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed2c66da08abae1c024c01d635253e402341b4060a12e99b31c7594063bf490a"
dependencies = [
"bitflags 1.3.2",
"crossbeam-channel 0.5.8",
"filetime",
"fsevent-sys",
"inotify",
"kqueue",
"libc",

View file

@ -110,7 +110,8 @@ log = "=0.4.20"
lsp-types = "=0.94.1" # used by tower-lsp and "proposed" feature is unstable in patch releases
memmem = "0.1.1"
monch = "=0.4.3"
notify = "=5.0.0"
# Note: Do not use the "macos_fsevent" feature of notify, as it links us to CoreFoundation on macOS.
notify = { version = "=5.0.0", default-features = false, features = ["macos_kqueue"] }
num-bigint = { version = "0.4", features = ["rand"] }
once_cell = "1.17.1"
os_pipe = "=1.1.4"

View file

@ -70,6 +70,7 @@
"test-fs-open.js",
"test-fs-opendir.js",
"test-fs-rmdir-recursive.js",
"test-fs-watchfile.js",
"test-fs-write-file.js",
"test-fs-write.js",
"test-http-url.parse-https.request.js",

View file

@ -107,6 +107,6 @@ if (common.isLinux || common.isOSX || common.isWindows) {
fs.writeFile(path.join(dir, 'foo.txt'), 'foo', common.mustCall((err) => {
if (err) assert.fail(err);
}));
}, 1);
}, 20);
}));
}

View file

@ -22,7 +22,7 @@ Deno.test({ permissions: { read: true } }, function watchFsInvalidPath() {
} else {
assertThrows(() => {
Deno.watchFs("non-existent.file");
}, Deno.errors.NotFound);
}, Error);
}
});
@ -32,7 +32,7 @@ async function getTwoEvents(
const events = [];
for await (const event of iter) {
events.push(event);
if (events.length > 2) break;
if (events.length == 2) break;
}
return events;
}