Module xshell
Shell-like scripting in Rust without invoking a shell.
xshell provides ergonomic subprocess execution with shell-like syntax.
It executes commands directly without spawning a shell process,
preventing shell injection vulnerabilities while providing
variable interpolation in the cmd! macro.
Useful for build scripts, CLI tools, and automation tasks.
Examples
Running commands with variable interpolation:
use ;
let sh = new?;
let name = "world";
let output = cmd!.read?;
assert!;
# Ok::
Reading files relative to the shell's working directory:
use Shell;
use PathBuf;
let sh = new?;
// Read a file relative to cwd
let cargo_toml = sh.read_file?;
assert!;
# Ok::
Structs
- Cmd A builder object for constructing a subprocess.
-
PushDir
RAII guard returned from
Shell::push_dir. -
PushEnv
RAII guard returned from
Shell::push_env. -
Shell
A
Shellis the main API entry point. - TempDir A temporary directory.