Skip to content

Commit a81435e

Browse files
committed
fs: fix shell quoting of optional argument
fixes #49
1 parent a13ddc0 commit a81435e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

widgets/fs_all.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ local unit = { ["mb"] = 1024, ["gb"] = 1024^2 }
2323

2424
-- {{{ Filesystem widget type
2525
local function worker(format, warg)
26-
-- Fallback to listing local filesystems
27-
if warg then warg = "" else warg = "-l" end
26+
local cmd = "LC_ALL=C df -kP"
27+
if not warg then
28+
-- List only local filesystems by default
29+
cmd = cmd .. " -l"
30+
end
2831

2932
local fs_info = {} -- Get data from df
30-
local f = io.popen("LC_ALL=C df -kP " .. helpers.shellquote(warg))
33+
local f = io.popen(cmd)
3134

3235
for line in f:lines() do -- Match: (size) (used)(avail)(use%) (mount)
3336
local s = string.match(line, "^.-[%s]([%d]+)")

0 commit comments

Comments
 (0)