refactor: use v0.4 Error type for error handling

This commit is contained in:
sxyazi
2024-12-24 17:53:35 +08:00
parent c7feb90930
commit 71c4fc2e6f
4 changed files with 5 additions and 5 deletions

View File

@@ -1,9 +1,9 @@
local M = {}
function M:peek(job)
local child, code = Command("lsar"):arg(tostring(job.file.url)):stdout(Command.PIPED):spawn()
local child, err = Command("lsar"):arg(tostring(job.file.url)):stdout(Command.PIPED):spawn()
if not child then
return ya.err("spawn `lsar` command returns " .. tostring(code))
return ya.err("spawn `lsar` command failed: " .. err)
end
-- Skip the first line which is the archive file itself