Skip to content

Commit

Permalink
scripts/chwd: Improve error logging during hooks calls
Browse files Browse the repository at this point in the history
Signed-off-by: Vasiliy Stelmachenok <ventureo@cachyos.org>
  • Loading branch information
ventureoo committed Nov 14, 2024
1 parent 0953acc commit aa458e3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/chwd
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ local function exec_hook(hook)
end

if hook ~= "" then
local file = io.popen(("/bin/bash -c '%s'"):format(hook), "r")
local handle, errmsg = io.popen(("/bin/bash -c '%s'"):format(hook), "r")

if file then
local output = file:read('*all')
file:close()
if handle then
local output = handle:read('*all')
handle:close()
return output
else
print("ERROR: Unkown shell invocation error", hook)
print(("ERROR: Unkown shell invocation error for %s hook: %s"):format(hook, errmsg))
end
end
end
Expand Down

0 comments on commit aa458e3

Please sign in to comment.