Available on crate feature
process only.Expand description
Utility to configure IO with child process.
The cu::pio::* functions can be used as arguments
into the stdin, stdout and stderr functions
of the Command builder to configure how you want to interact
with the child process’s IO.
An input config can only be passed into stdin, whereas
an output config can be used both for stdout and stderr.
null and inherit can be used both as input and output.
§Available configurations
cu::pio::null(): Turn off the stream, essentiallyStdio::null().cu::pio::inherit(): Turn off the stream, essentiallyStdio::inherit().- Note that the child outputs will mess with output from this crate.
cu::lv::*: Read the child’s output and print them as a log message of the level.cu::pio::spinner(): Show a progress bar for the child’s output. Optionally also print non-progress outputs as regular messages.cu::pio::pipe(): Get aPipefrom the output, which can be passed as an input config to another command to pipe the output to its stdin.cu::pio::buffer(): Buffer the output as aVec<u8>.cu::pio::string(): Buffer the output as aString.cu::pio::lines(): Get a reader that can read the output line-by-line.- See
cu::pio::co_lines()for using an async reader.
- See
cu::pio::write(buf): Write an in-memory buffer to child’s stdin
§Presets
Presets may apply more than just IO configuration, such as adding additional arguments or environments.
cu::pio::cargo(): Progress for acargo buildcommand.
Modules§
- config
- internal task types used in trait implementations
- output
- internal output types used in trait implementations
- task
- internal task types used in trait implementations
Structs§
- CoLines
- Output of
co_lines, an ansynchronous iterator that can reads the output line-by-line. - Lines
- Output of
lines, a synchronous iterator that can reads the output line-by-line. - Pipe
- The output of
pipe. Can be piped into another command’sstdin.
Traits§
- Child
InConfig - Configuration for process input to be used with
Command::stdin - Child
InTask - Task created by
ChildInConfig - Child
OutConfig - Configuration for process output to be used with
Command::stdoutandCommand::stderr - Child
OutTask - Task created by
ChildOutConfig
Functions§
- buffer
- Buffer the output as a
Vec<u8> - cargo
jsonandprint - Display progress of cargo task with a progress bar, and emitting status messages and diagnostic messages using this crate’s printing utilities.
- co_
lines - Create reader to access output line-by-line.
- inherit
- Inherit the parent’s stdin, stdout, or stderr.
- lines
- Create reader to access output line-by-line.
- null
- Direct the stream to null (i.e. ignore it)
- pipe
- Pipe the child’s output into another command’s stdin.
- spinner
print - Display child process’s status as a progress bar spinner.
- string
- Buffer the output as a
String. Will error if the output is not valid UTF-8. - write
- Write an in-memory buffer to child’s stdin.