X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/30658f602bff127945b0a5acee551fd58eb226fc..8468b88f4a6fd21042253d463c500f6da6f6d2fc:/asyncshell.lua diff --git a/asyncshell.lua b/asyncshell.lua index 4a01caa..0aafa17 100644 --- a/asyncshell.lua +++ b/asyncshell.lua @@ -10,11 +10,9 @@ -- How to use... -- ...asynchronously: -- asyncshell.request('wscript -Kiev', function(f) wwidget.text = f:read("*l") end) --- ...synchronously +-- ...synchronously: -- 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 asyncshell = {} @@ -44,8 +42,7 @@ function asyncshell.request(command, callback) 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