awful.util: pread return error
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
58eb27a99b
commit
a71c5efd10
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue