X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/973b56ce0b9ce214b5dc17795893ece7def6ce78..554d206f5fbc1e04e8863b07b7e2448163857050:/helpers.lua?ds=inline 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 = {}