summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2022-02-26 12:09:45 +0200
committerAvi Halachmi (:avih) <avihpit@yahoo.com>2022-03-03 15:01:40 +0200
commitb15b3f6711b996b0e837f0881a31d97192efa778 (patch)
treeaf1b77ddd62a9ed41e7950901d95de0e4fc99de7
parent11f0947d460c85b82c7e5fdb642c3dccdb1f6e07 (diff)
downloadmpv-b15b3f6711b996b0e837f0881a31d97192efa778.tar.bz2
mpv-b15b3f6711b996b0e837f0881a31d97192efa778.tar.xz
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.
-rw-r--r--player/lua/ytdl_hook.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index 613f5a3286..26913763df 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -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)