diff --git a/yazi-fm/Cargo.toml b/yazi-fm/Cargo.toml index e33abb02..7d065fd2 100644 --- a/yazi-fm/Cargo.toml +++ b/yazi-fm/Cargo.toml @@ -23,6 +23,7 @@ better-panic = "^0" crossterm = { version = "^0", features = [ "event-stream" ] } fdlimit = "^0" futures = "^0" +mlua = { version = "^0", features = [ "lua54", "vendored" ] } ratatui = "^0" tokio = { version = "^1", features = [ "parking_lot" ] } unicode-width = "^0" @@ -36,12 +37,6 @@ tracing-subscriber = "^0" libc = "^0" signal-hook-tokio = { version = "^0", features = [ "futures-v0_3" ] } -[target.'cfg(any(target_arch="riscv64", target_arch="loongarch64"))'.dependencies] -mlua = { version = "^0", features = [ "lua52", "vendored" ] } - -[target.'cfg(not(any(target_arch="riscv64", target_arch="loongarch64")))'.dependencies] -mlua = { version = "^0", features = [ "luajit52", "vendored" ] } - [[bin]] name = "yazi" path = "src/main.rs" diff --git a/yazi-plugin/Cargo.toml b/yazi-plugin/Cargo.toml index 38517200..75c47a63 100644 --- a/yazi-plugin/Cargo.toml +++ b/yazi-plugin/Cargo.toml @@ -20,6 +20,7 @@ crossterm = "^0" futures = "^0" libc = "^0" md-5 = "^0" +mlua = { version = "^0", features = [ "lua54", "vendored", "serialize", "macros", "async" ] } parking_lot = "^0" ratatui = "^0" serde = "^1" @@ -30,9 +31,3 @@ tokio-util = "^0" tracing = { version = "^0", features = [ "max_level_debug", "release_max_level_warn" ] } unicode-width = "^0" yazi-prebuild = "^0" - -[target.'cfg(any(target_arch="riscv64", target_arch="loongarch64"))'.dependencies] -mlua = { version = "^0", features = [ "lua52", "vendored", "serialize", "macros", "async" ] } - -[target.'cfg(not(any(target_arch="riscv64", target_arch="loongarch64")))'.dependencies] -mlua = { version = "^0", features = [ "luajit52", "vendored", "serialize", "macros", "async" ] } diff --git a/yazi-plugin/src/isolate/peek.rs b/yazi-plugin/src/isolate/peek.rs index b1d8ef55..c87bf4be 100644 --- a/yazi-plugin/src/isolate/peek.rs +++ b/yazi-plugin/src/isolate/peek.rs @@ -12,19 +12,18 @@ pub fn peek(exec: &Exec, file: yazi_shared::fs::File, skip: usize) -> Cancellati let ct = CancellationToken::new(); let cmd = exec.cmd.to_owned(); - let ct2 = ct.clone(); + let (ct1, ct2) = (ct.clone(), ct.clone()); tokio::task::spawn_blocking(move || { let future = async { LOADED.ensure(&cmd).await.into_lua_err()?; let lua = slim_lua()?; - // FIXME: this will cause a panic - // lua.set_hook( - // HookTriggers::new().on_calls().on_returns().every_nth_instruction(2000), - // move |_, _| { - // if ct1.is_cancelled() { Err("cancelled".into_lua_err()) } else { Ok(()) } - // }, - // ); + lua.set_hook( + HookTriggers::new().on_calls().on_returns().every_nth_instruction(2000), + move |_, _| { + if ct1.is_cancelled() { Err("cancelled".into_lua_err()) } else { Ok(()) } + }, + ); let plugin: Table = if let Some(b) = LOADED.read().get(&cmd) { lua.load(b).call(())?