fix: ignore peek task cancellation error

This commit is contained in:
sxyazi 2024-01-10 03:12:57 +08:00
parent d7d000c213
commit cd84386ead
No known key found for this signature in database
2 changed files with 6 additions and 3 deletions

View File

@ -31,7 +31,7 @@ function M:preload()
return 1
end
local child = Command("ffmpegthumbnailer"):args({
local child, code = Command("ffmpegthumbnailer"):args({
"-q",
"6",
"-c",
@ -47,6 +47,7 @@ function M:preload()
}):spawn()
if not child then
ya.err("spawn `ffmpegthumbnailer` command returns " .. tostring(code))
return 0
end

View File

@ -21,7 +21,7 @@ pub fn peek(exec: &Exec, file: yazi_shared::fs::File, skip: usize) -> Cancellati
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(()) }
if ct1.is_cancelled() { Err("Peek task cancelled".into_lua_err()) } else { Ok(()) }
},
);
@ -46,7 +46,9 @@ pub fn peek(exec: &Exec, file: yazi_shared::fs::File, skip: usize) -> Cancellati
});
if let Err(e) = result {
error!("{e}");
if !e.to_string().contains("Peek task cancelled") {
error!("{e}");
}
}
});