Module process

Source
Available on crate feature process only.
Expand description

A SourceStream adapter for reading data from external processes. This is a wrapper on top of the async_read module.

Due to limitations with reading stdout and stderr simultaneously while piping large amounts of data to stdin (see std::process::Stdio::piped), the child process’ stderr handle will be redirected to a temporary file rather than piped directly into the program unless explicitly overridden with Command::stderr_handle.

This implementation makes the assumption that any commands used will output binary data to stdout and any error messages will be logged to stderr. You probably want to disable Settings::cancel_on_drop when using this module in order to ensure all error messages are flushed before the process is stopped.

Helpers for interacting with yt-dlp for extracting media from specific sites and ffmpeg for post-processing are also included.

Structs§

Command
A simplified representation of an OS command that can be used to create a SpawnedCommand.
CommandBuilder
A builder object that can pipe multiple commands together and automatically configure the child process’ handles correctly.
FfmpegConvertAudioCommand
Helper to construct a valid ffmpeg command that reads from stdin, converts the input to the provided format, and sends the output to stdout. This is useful for performing post-processing on a media stream that needs to be converted to a different format.
ProcessStream
A SourceStream implementation that asynchronously reads the stdout byte stream from a tokio::process::Command.
ProcessStreamParams
Parameters for creating a ProcessStream.
SpawnedCommand
A representation of a tokio::process::Command that’s been spawned.
YtDlpCommand
Helper to construct a valid yt-dlp command that outputs to stdout.

Traits§

SpawnCommand
Trait used by objects that can spawn a command suitable for use with a ProcessStream.