awful.util: pread return error

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-25 20:16:35 +02:00
parent 58eb27a99b
commit a71c5efd10
1 changed files with 2 additions and 3 deletions

View File

@ -11,7 +11,6 @@ local assert = assert
local loadstring = loadstring local loadstring = loadstring
local loadfile = loadfile local loadfile = loadfile
local debug = debug local debug = debug
local print = print
local pairs = pairs local pairs = pairs
local ipairs = ipairs local ipairs = ipairs
local type = type local type = type
@ -91,7 +90,7 @@ end
--- Read a program output and returns its output as a string. --- Read a program output and returns its output as a string.
-- @param cmd The command to run. -- @param cmd The command to run.
-- @return A string with the program output. -- @return A string with the program output, or the error if one occured.
function pread(cmd) function pread(cmd)
if cmd and cmd ~= "" then if cmd and cmd ~= "" then
local f, err = io.popen(cmd, 'r') local f, err = io.popen(cmd, 'r')
@ -100,7 +99,7 @@ function pread(cmd)
f:close() f:close()
return s return s
else else
print(err) return err
end end
end end
end end