Qubit Command
Command-line process running utilities for Rust.
Overview
Qubit Command provides a small, structured API for running external programs, capturing their output, enforcing timeouts, and reporting command failures with clear error values.
Features
- Structured command execution with program and argument vectors
- Explicit shell command support for cases that require shell parsing
- Configurable timeout, working directory, environment variables, and success exit codes
- UTF-8 stdout and stderr text accessors, with raw byte accessors for binary output
- Typed errors for spawn failures, timeouts, failed output reads, and unexpected exit codes
Quick Start
use Duration;
use ;
let output = new
.timeout
.run?;
println!;
# Ok::
Shell Commands
Prefer structured commands whenever possible:
use ;
let output = new
.run?;
assert_eq!;
# Ok::
Use Command::shell only when shell parsing, redirection, expansion, or
pipes are intentional:
use ;
let output = new
.run?;
assert_eq!;
# Ok::
Output Text
stdout() and stderr() return UTF-8 text by default. Use stdout_bytes() and
stderr_bytes() when a command can emit arbitrary bytes. To replace invalid
UTF-8 bytes with �, enable lossy output on the runner:
use ;
let output = new
.lossy_output
.run?;
assert_eq!;
# Ok::
Testing