os: change os.getenv init to allow standalone usage of os widget

Test case:
lua> foo = require("vicious.widgets.os")
lua> print(foo()[1])
     /usr/share/lua/5.1/vicious/widgets/os.lua:66: attempt to call
     field 'getenv' (a nil value)
This commit is contained in:
Adrian C. (anrxc) 2012-06-25 00:39:23 +02:00
parent 1a7b43068c
commit e1c7c4772a
1 changed files with 2 additions and 2 deletions

View File

@ -7,8 +7,8 @@
local pairs = pairs local pairs = pairs
local tonumber = tonumber local tonumber = tonumber
local io = { popen = io.popen } local io = { popen = io.popen }
local os = { getenv = os.getenv }
local math = { ceil = math.ceil } local math = { ceil = math.ceil }
local los = { getenv = os.getenv }
local setmetatable = setmetatable local setmetatable = setmetatable
local helpers = require("vicious.helpers") local helpers = require("vicious.helpers")
local string = { local string = {
@ -63,7 +63,7 @@ local function worker(format)
end end
-- Get user from the environment -- Get user from the environment
system["username"] = os.getenv("USER") system["username"] = los.getenv("USER")
return {system["ostype"], system["osrelease"], system["username"], return {system["ostype"], system["osrelease"], system["username"],
system["hostname"], system["entropy"], system["entropy_p"]} system["hostname"], system["entropy"], system["entropy_p"]}