mirror of
https://github.com/mpv-player/mpv
synced 2025-02-17 21:27:08 +00:00
ytdl_hook.lua: consider any subprocess status != 0 as error
Previously only status<0 was considered as error, but status>0 is also an error (the process exit code). Change to status != 0. This likely makes little to no difference in practice, because if stdout is empty or can't be parsed as JSON then it's considered an error anyway, but still, this is more correct. Also, on error, add the complete subprocess result to the verbose log.
This commit is contained in:
parent
11f0947d46
commit
b15b3f6711
@ -825,13 +825,18 @@ function run_ytdl_hook(url)
|
||||
|
||||
local parse_err = nil
|
||||
|
||||
if (es < 0) or (json == "") then
|
||||
if (es ~= 0) or (json == "") then
|
||||
json = nil
|
||||
elseif json then
|
||||
json, parse_err = utils.parse_json(json)
|
||||
end
|
||||
|
||||
if (json == nil) then
|
||||
msg.verbose("status:", es)
|
||||
msg.verbose("reason:", result.error_string)
|
||||
msg.verbose("stdout:", result.stdout)
|
||||
msg.verbose("stderr:", result.stderr)
|
||||
|
||||
-- trim our stderr to avoid spurious newlines
|
||||
ytdl_err = result.stderr:gsub("^%s*(.-)%s*$", "%1")
|
||||
msg.error(ytdl_err)
|
||||
|
Loading…
Reference in New Issue
Block a user