diff options
Diffstat (limited to 'widgets/raid.lua')
-rw-r--r-- | widgets/raid.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/widgets/raid.lua b/widgets/raid.lua index e236d11..58a7359 100644 --- a/widgets/raid.lua +++ b/widgets/raid.lua @@ -4,7 +4,7 @@ ----------------------------------------------------- -- {{{ Grab environment -local io = { lines = io.lines } +local io = { open = io.open } local setmetatable = setmetatable local string = { len = string.len, @@ -33,7 +33,8 @@ local function worker(format, warg) } -- Linux manual page: md(4) - for line in io.lines("/proc/mdstat") do + local fd = io.open("/proc/mdstat") + for line in fd:lines() do if mddev[warg]["found"] then local updev = string.match(line, "%[[_U]+%]") @@ -50,6 +51,7 @@ local function worker(format, warg) end end end + fd:close() return {mddev[warg]["assigned"], mddev[warg]["active"]} end |