Quote directory in util.diskUsage (#13448)

If not quoted, this function does not work with directories that include a space in their name
This commit is contained in:
Robert Greener
2025-04-09 12:01:47 +01:00
committed by GitHub
parent 6efae12ba0
commit edb8f29de0

View File

@@ -920,7 +920,7 @@ end
function util.diskUsage(dir)
-- safe way of testing df & awk
local function doCommand(d)
local handle = io.popen("df -k " .. d .. " 2>/dev/null | awk '$3 ~ /[0-9]+/ { print $2,$3,$4 }' 2>/dev/null || echo ::ERROR::")
local handle = io.popen("df -k " .. util.shell_escape({d}) .. " 2>/dev/null | awk '$3 ~ /[0-9]+/ { print $2,$3,$4 }' 2>/dev/null || echo ::ERROR::")
if not handle then return end
local output = handle:read("*all")
handle:close()