mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: ignore peek task cancellation error
This commit is contained in:
parent
d7d000c213
commit
cd84386ead
2 changed files with 6 additions and 3 deletions
|
|
@ -31,7 +31,7 @@ function M:preload()
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
local child = Command("ffmpegthumbnailer"):args({
|
local child, code = Command("ffmpegthumbnailer"):args({
|
||||||
"-q",
|
"-q",
|
||||||
"6",
|
"6",
|
||||||
"-c",
|
"-c",
|
||||||
|
|
@ -47,6 +47,7 @@ function M:preload()
|
||||||
}):spawn()
|
}):spawn()
|
||||||
|
|
||||||
if not child then
|
if not child then
|
||||||
|
ya.err("spawn `ffmpegthumbnailer` command returns " .. tostring(code))
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ pub fn peek(exec: &Exec, file: yazi_shared::fs::File, skip: usize) -> Cancellati
|
||||||
lua.set_hook(
|
lua.set_hook(
|
||||||
HookTriggers::new().on_calls().on_returns().every_nth_instruction(2000),
|
HookTriggers::new().on_calls().on_returns().every_nth_instruction(2000),
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
if ct1.is_cancelled() { Err("cancelled".into_lua_err()) } else { Ok(()) }
|
if ct1.is_cancelled() { Err("Peek task cancelled".into_lua_err()) } else { Ok(()) }
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -46,8 +46,10 @@ pub fn peek(exec: &Exec, file: yazi_shared::fs::File, skip: usize) -> Cancellati
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
|
if !e.to_string().contains("Peek task cancelled") {
|
||||||
error!("{e}");
|
error!("{e}");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ct
|
ct
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue