awful: add pread() function
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
5e9e28e205
commit
03dffd34dd
|
@ -844,6 +844,18 @@ function spawn(cmd, screen)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Read a program output and returns its output as a string.
|
||||||
|
-- @param cmd The command to run.
|
||||||
|
-- @return A string with the program output.
|
||||||
|
function pread(cmd)
|
||||||
|
if cmd and cmd ~= "" then
|
||||||
|
local f = io.popen(cmd, 'r')
|
||||||
|
local s = f:read("*all")
|
||||||
|
f:close()
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- Eval Lua code.
|
--- Eval Lua code.
|
||||||
-- @return The return value of Lua code.
|
-- @return The return value of Lua code.
|
||||||
function eval(s)
|
function eval(s)
|
||||||
|
|
Loading…
Reference in New Issue