From a81435e1be90416ec6456aabcfbd220b1c2af56b Mon Sep 17 00:00:00 2001 From: Joerg Thalheim Date: Thu, 30 Nov 2017 08:49:39 +0000 Subject: [PATCH] fs: fix shell quoting of optional argument fixes #49 --- widgets/fs_all.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/widgets/fs_all.lua b/widgets/fs_all.lua index eb4d044..b577431 100644 --- a/widgets/fs_all.lua +++ b/widgets/fs_all.lua @@ -23,11 +23,14 @@ local unit = { ["mb"] = 1024, ["gb"] = 1024^2 } -- {{{ Filesystem widget type local function worker(format, warg) - -- Fallback to listing local filesystems - if warg then warg = "" else warg = "-l" end + local cmd = "LC_ALL=C df -kP" + if not warg then + -- List only local filesystems by default + cmd = cmd .. " -l" + end 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) local s = string.match(line, "^.-[%s]([%d]+)")