awful.util: add spawn_with_shell (FS#515)

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-04-30 00:39:51 +02:00
parent b38ebbeac1
commit 2b0d3f6ab2
1 changed files with 14 additions and 0 deletions

View File

@ -74,6 +74,20 @@ function spawn(cmd, sn, screen)
end end
end end
--- Spawn a program using the shell.
-- @param cmd The command.
-- @param screen The screen where to run the command.
function spawn_with_shell(cmd, screen)
if cmd and cmd ~= "" then
-- Get the shell once for all
if not shell then
shell = os.getenv("SHELL") or "/bin/sh"
end
cmd = shell .. " -c \"" .. cmd .. "\""
return capi.awesome.spawn(cmd, false, screen or capi.mouse.screen)
end
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.