Crate duct [] [src]

A cross-platform library for running child processes and building pipelines.

duct wants to make shelling out in Rust as easy and flexible as it is in Bash. It also takes care of tricky inconsistencies in the way different platforms shell out. And it's a cross-language library; the original implementation is in Python, with an identical API.

Example

duct uses os_pipe internally, and the docs for that one include a big example that uses more than a dozen lines of code to read both stdout and stderr from a child process. duct can do that in one line:

use duct::sh;

let output = sh("echo foo && echo bar >&2").stderr_to_stdout().read().unwrap();

assert!(output.split_whitespace().eq(vec!["foo", "bar"]));

Macros

cmd

Create a command with any number of of positional arguments, which may be different types (anything that implements Into<OsString>). See also the cmd function, which takes a collection of arguments.

Structs

Expression

Enums

Error

Traits

ToExecutable

Functions

cmd

Create a command given a program name and a collection of arguments. See also the cmd! macro, which doesn't require a collection.

sh

Create a command from a string of shell code.