1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//! Execution of and interaction with external processes and pipelines.
//!
//! The main entry points to the crate are the [`Exec`] and [`Pipeline`] builders.
//! They provide a builder-pattern API with convenient methods for streaming and capturing
//! of output, as well as combining commands into pipelines.
//!
//! Compared to `std::process`, the crate provides these additional features:
//!
//! * Connecting multiple commands into OS-level [pipelines](Pipeline).
//!
//! * The *capture* and *communicate* [family of methods](Job::capture) for
//! deadlock-free capturing of subprocess output/error, while simultaneously feeding
//! data to its standard input. Capturing supports optional timeout and read size
//! limit.
//!
//! * Flexible [redirection options](Redirection), such as connecting standard streams to
//! arbitrary [open files](Redirection::File), or [merging](Redirection::Merge) output
//! streams like shell's `2>&1` and `1>&2` operators.
//!
//! * Non-blocking and timeout methods to wait on the process: [`poll`](Process::poll),
//! [`wait`](Process::wait), and [`wait_timeout`](Process::wait_timeout).
//!
//! # Examples
//!
//! Execute a command and capture its output:
//!
//! ```
//! # use subprocess::*;
//! # fn dummy() -> std::io::Result<()> {
//! let out = Exec::cmd("echo").arg("hello").capture()?.stdout_str();
//! assert!(out.contains("hello"));
//! # Ok(())
//! # }
//! ```
//!
//! Use the [`Exec`] builder to execute a pipeline of commands and capture the output:
//!
//! ```no_run
//! # use subprocess::*;
//! # fn dummy() -> std::io::Result<()> {
//! let dir_checksum = {
//! Exec::shell("find . -type f") | Exec::cmd("sort") | Exec::cmd("sha1sum")
//! }.capture()?.stdout_str();
//! # Ok(())
//! # }
//! ```
pub use Communicator;
pub use Redirection;
pub use ExecExt;
pub use JobExt;
pub use PipelineExt;
pub use ExecExt;
pub use ;
pub use Job;
pub use Pipeline;
pub use ExitStatus;
pub use Process;
/// Subprocess extensions for Unix platforms.
/// Subprocess extensions for Windows platforms.