Module exec

Source
Expand description

APIs for spawning subprocesses and handling their results.

Macrosยง

docs_errors_exec ๐Ÿ”’
docs_errors_grep ๐Ÿ”’

Structsยง

Cmd
A command to be executed, provided in command-flags-keywords form.

Enumsยง

Mode
Different ways in which a Cmd shall be dealt with.

Functionsยง

exec_tee ๐Ÿ”’
Takes contents from an input stream and copy to an output stream (optional) and a Vec<u8>, then returns the Vec<u8>.
exit_result ๐Ÿ”’
Returns a Result for a Cmd according to if its exit status code indicates an error.
grep
Finds all lines in the given text that matches all the patterns.
grep_print
Prints the result of grep line by line.
grep_print_with_header
Prints the result of grep line by line, with header_lines of header prepended. If header_lines >= text.lines().count(), then text is printed without changes.
into_bytes ๐Ÿ”’
Turns an [AsyncRead] into a [Stream].
is_exe
Checks if an executable exists by name (consult $PATH) or by path.
is_root
Checks if the current user is root or admin.
prompt ๐Ÿ”’
Gives a prompt and returns the index of the user choice.

Type Aliasesยง

Output
The type for captured stdout, and if set to Mode::CheckAll, mixed with captured stderr.
StatusCode
The status code type returned by a Cmd,