Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

exec

Executes a shell command and returns its exit code and standard output.

Prefer using output if you only care about successful commands and want an error otherwise.

let (code, out) = shell::exec("echo Cairo").unwrap();
assert_eq!(code, 0);
assert_eq!(out, "Cairo\n");

Fully qualified path: shell::exec

pub fn exec(command: ByteArray) -> Result<(i32, ByteArray), Error>