Crate unix_exec_output_catcher[][src]

Expand description

This library lets you execute a child process and catch its output (stdout and stderr). This is useful if you want to use the output from a specific command and transform it in your program.

⚠️ Difference to std::process::Command 🚨 std::process::Command does the same in the standard library but with one exception: My library gives you access to stdout, stderr, and "stdcombined". This way you get all output lines in the order they appeared. That’s the unique feature of this crate.

Modules

error

Contains all errors that can happen in this library.

Structs

ProcessOutput

Holds the information from the executed process. It depends on the strategy option of crate::fork_exec_and_catch how the output is structured.

Enums

OCatchStrategy

Determines the strategy that is used to get STDOUT, STDERR, and “STDCOMBINED”. Both has advantages and disadvantages.

Functions

fork_exec_and_catch

Executes a program in a child process and returns the output of STDOUT and STDERR line by line in a vector. Be aware that this is blocking and static! So if your executable produces 1GB of output text, the data of the vectors of the returned structs is also 1GB in size. If the program doesn’t terminate, this function will neither.