pub fn exec(cmd: &str, cwd: &Path) -> Result<Output, Error>
Expand description
Returns output to give command
It takes in the command/binary to execute, optional flags and the path to execute it in.
It will only execute if the provided cmd
is found on host and cwd
exists
as a directory.
§Arguments
cmd
- The binary to execute.cwd
- The directory to execute in.
§Examples
exec("hyprctl workspaces", Path::new("/home/user/repo"));
You can use it with get_pwd()
to avoid passing a path.
exec("hyprctl workspaces", None);