Skip to content

Commit

Permalink
fix: update rustix to fix the enable_raw_mode() error on WSL/Android
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Sep 7, 2024
1 parent 0cdaff9 commit 72571df
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 51 deletions.
78 changes: 39 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ anyhow = "1.0.86"
arc-swap = "1.7.1"
base64 = "0.22.1"
bitflags = "2.6.0"
clap = { version = "4.5.16", features = [ "derive" ] }
clap = { version = "4.5.17", features = [ "derive" ] }
crossterm = { version = "0.28.1", features = [ "event-stream" ] }
dirs = "5.0.1"
futures = "0.3.30"
Expand All @@ -28,11 +28,11 @@ ratatui = { version = "0.28.1", features = [ "unstable-rendered-line-info"
regex = "1.10.6"
scopeguard = "1.2.0"
serde = { version = "1.0.209", features = [ "derive" ] }
serde_json = "1.0.127"
serde_json = "1.0.128"
shell-words = "1.1.0"
tokio = { version = "1.40.0", features = [ "full" ] }
tokio-stream = "0.1.15"
tokio-util = "0.7.11"
tokio-stream = "0.1.16"
tokio-util = "0.7.12"
tracing = { version = "0.1.40", features = [ "max_level_debug", "release_max_level_warn" ] }
unicode-width = "0.1.13"
uzers = "0.12.1"
2 changes: 1 addition & 1 deletion yazi-boot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ serde = { workspace = true }

[build-dependencies]
clap = { workspace = true }
clap_complete = "4.5.24"
clap_complete = "4.5.26"
clap_complete_fig = "4.5.2"
clap_complete_nushell = "4.5.3"
vergen-gitcl = { version = "1.0.0", features = [ "build" ] }
2 changes: 1 addition & 1 deletion yazi-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ yazi-shared = { path = "../yazi-shared", version = "0.3.3" }
# External build dependencies
anyhow = { workspace = true }
clap = { workspace = true }
clap_complete = "4.5.24"
clap_complete = "4.5.26"
clap_complete_fig = "4.5.2"
clap_complete_nushell = "4.5.3"
serde_json = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion yazi-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bitflags = { workspace = true }
crossterm = { workspace = true }
dirs = { workspace = true }
futures = { workspace = true }
notify-fork = { version = "6.1.1", default-features = false, features = [ "macos_fsevent" ] }
notify = { package = "notify-fork", version = "6.1.1", default-features = false, features = [ "macos_fsevent" ] }
parking_lot = { workspace = true }
ratatui = { workspace = true }
scopeguard = { workspace = true }
Expand Down
10 changes: 5 additions & 5 deletions yazi-core/src/manager/watcher.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{collections::{HashMap, HashSet}, time::Duration};

use anyhow::Result;
use notify_fork::{PollWatcher, RecommendedWatcher, RecursiveMode, Watcher as _Watcher};
use notify::{PollWatcher, RecommendedWatcher, RecursiveMode, Watcher as _Watcher};
use parking_lot::RwLock;
use tokio::{fs, pin, sync::{mpsc::{self, UnboundedReceiver}, watch}};
use tokio_stream::{wrappers::UnboundedReceiverStream, StreamExt};
Expand All @@ -27,7 +27,7 @@ impl Watcher {
let (out_tx, out_rx) = mpsc::unbounded_channel();

let out_tx_ = out_tx.clone();
let handler = move |res: Result<notify_fork::Event, notify_fork::Error>| {
let handler = move |res: Result<notify::Event, notify::Error>| {
let Ok(event) = res else { return };
if event.kind.is_access() {
return;
Expand All @@ -37,7 +37,7 @@ impl Watcher {
}
};

let config = notify_fork::Config::default().with_poll_interval(Duration::from_millis(500));
let config = notify::Config::default().with_poll_interval(Duration::from_millis(500));
if *yazi_adapter::WSL {
tokio::spawn(Self::fan_in(in_rx, PollWatcher::new(handler, config).unwrap()));
} else {
Expand Down Expand Up @@ -79,7 +79,7 @@ impl Watcher {
});
}

async fn fan_in(mut rx: watch::Receiver<HashSet<Url>>, mut watcher: impl notify_fork::Watcher) {
async fn fan_in(mut rx: watch::Receiver<HashSet<Url>>, mut watcher: impl notify::Watcher) {
loop {
let (mut to_unwatch, mut to_watch): (HashSet<_>, HashSet<_>) = {
let (new, old) = (&*rx.borrow_and_update(), &*WATCHED.read());
Expand All @@ -88,7 +88,7 @@ impl Watcher {

to_unwatch.retain(|u| match watcher.unwatch(u) {
Ok(_) => true,
Err(e) if matches!(e.kind, notify_fork::ErrorKind::WatchNotFound) => true,
Err(e) if matches!(e.kind, notify::ErrorKind::WatchNotFound) => true,
Err(e) => {
error!("Unwatch failed: {e:?}");
false
Expand Down

0 comments on commit 72571df

Please sign in to comment.