X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/823659d83d1262bbd94821e8460822c0130fff56..7233039f9fa4599c5c76fef4ff4534c996c64c06:/asyncshell.lua?ds=sidebyside diff --git a/asyncshell.lua b/asyncshell.lua index 4eb8d2e..36ccc47 100644 --- a/asyncshell.lua +++ b/asyncshell.lua @@ -11,7 +11,9 @@ -- ...asynchronously: -- asyncshell.request('wscript -Kiev', function(f) wwidget.text = f:read("*l") end) -- ...synchronously --- wwidget.text = asyncshell.demand('wscript -Kiev', 5):read("*l") or "Error" +-- widget:set_text(asyncshell.demand('wscript -Kiev', 5):read("*l") or "Error") + +-- This is more cpu demanding, but makes things faster. local spawn = require('awful.util').spawn @@ -37,13 +39,12 @@ end function asyncshell.request(command, callback) local id = next_id() local tmpfname = asyncshell.file_template .. id - asyncshell.request_table[id] = {callback = callback} + asyncshell.request_table[id] = { callback = callback } local req = string.format("sh -c '%s > %s; " .. 'echo "asyncshell.deliver(%s)" | ' .. "awesome-client' 2> /dev/null", - string.gsub(command, "'", "'\\''"), tmpfname, - id, tmpfname) + string.gsub(command, "'", "'\\''"), tmpfname, id) spawn(req, false) return id end