awful.util: add spawn_with_shell (FS#515)
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
b38ebbeac1
commit
2b0d3f6ab2
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue