X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/e1450f8828c1be4e290cec0a34538ebe6cb86b50..fc8ea20ab569ec39de93e64540d173ea1214b2ec:/helpers.lua diff --git a/helpers.lua b/helpers.lua index dbee617..4e90e16 100644 --- a/helpers.lua +++ b/helpers.lua @@ -10,7 +10,8 @@ local debug = require("debug") local capi = { timer = timer } local io = { open = io.open, - lines = io.lines } + lines = io.lines, + popen = io.popen } local rawget = rawget -- Lain helper functions for internal use @@ -86,6 +87,18 @@ end -- }}} +-- {{{ Pipe operations + +-- read the full output of a pipe (command) +function helpers.read_pipe(cmd) + local f = assert(io.popen(cmd)) + local output = f:read("*all") + f:close() + return output +end + +-- }}} + -- {{{ A map utility helpers.map_table = {}