fs: fix shell quoting of optional argument

fixes #49
This commit is contained in:
Joerg Thalheim 2017-11-30 08:49:39 +00:00
parent a13ddc0892
commit a81435e1be
1 changed files with 6 additions and 3 deletions

View File

@ -23,11 +23,14 @@ local unit = { ["mb"] = 1024, ["gb"] = 1024^2 }
-- {{{ Filesystem widget type -- {{{ Filesystem widget type
local function worker(format, warg) local function worker(format, warg)
-- Fallback to listing local filesystems local cmd = "LC_ALL=C df -kP"
if warg then warg = "" else warg = "-l" end if not warg then
-- List only local filesystems by default
cmd = cmd .. " -l"
end
local fs_info = {} -- Get data from df local fs_info = {} -- Get data from df
local f = io.popen("LC_ALL=C df -kP " .. helpers.shellquote(warg)) local f = io.popen(cmd)
for line in f:lines() do -- Match: (size) (used)(avail)(use%) (mount) for line in f:lines() do -- Match: (size) (used)(avail)(use%) (mount)
local s = string.match(line, "^.-[%s]([%d]+)") local s = string.match(line, "^.-[%s]([%d]+)")