pub struct Executor { /* private fields */ }Expand description
Represents a command executor.
§Example
let args = vec!["--update"];
let executor = Executor::new(
PathBuf::from("yt-dlp"),
utils::to_owned(args),
Duration::from_secs(30),
);
let output = executor.execute().await?;
println!("Output: {}", output.stdout);
Implementations§
Source§impl Executor
impl Executor
Sourcepub fn executable_path(&self) -> &PathBuf
pub fn executable_path(&self) -> &PathBuf
Sourcepub async fn execute(&self) -> Result<ProcessOutput>
pub async fn execute(&self) -> Result<ProcessOutput>
Sourcepub async fn execute_to_file(
&self,
output_path: impl Into<PathBuf>,
) -> Result<ProcessOutput>
pub async fn execute_to_file( &self, output_path: impl Into<PathBuf>, ) -> Result<ProcessOutput>
Executes the command and redirects stdout to a file.
§Arguments
output_path- The path where stdout will be written
§Returns
ProcessOutput containing stderr and exit code (stdout is written to file)
§Errors
This function will return an error if the command could not be executed, if the process timed out, or if the output file could not be created.
Sourcepub async fn execute_streaming(&self) -> Result<StreamingProcess>
pub async fn execute_streaming(&self) -> Result<StreamingProcess>
Spawns the command as a long-running process without timeout.
Returns a StreamingProcess handle that can be stopped gracefully
via stdin q (for FFmpeg) or killed. Intended for live recording.
§Errors
Returns an error if the process could not be spawned.
Trait Implementations§
impl StructuralPartialEq for Executor
Auto Trait Implementations§
impl Freeze for Executor
impl RefUnwindSafe for Executor
impl Send for Executor
impl Sync for Executor
impl Unpin for Executor
impl UnsafeUnpin for Executor
impl UnwindSafe for Executor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CommonTraits for T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.