pub fn run_redirect(&self, mut cmd: Command, stdout: &Path) -> Result<ExitStatus> {
        if self.args.verbose || self.args.dry_run {
            println!("{} > {}", render_command(&cmd).to_string_lossy(), stdout.display());
            if self.args.dry_run {
                // Short circuit. Difficult to mock an ExitStatus :(
                return Ok(<ExitStatus as std::os::unix::prelude::ExitStatusExt>::from_raw(0));
            }
        }
        let output_file = std::fs::File::create(&stdout)?;
        cmd.stdout(output_file);

        return cmd
            .status()
            .context(format!("Failed to invoke {}", cmd.get_program().to_string_lossy()));
    }
/// Run a job, redirect its output to a file, and allow the caller to decide what to do with failure.
Run a job, redirect its output to a file, and allow the caller to decide what to do with failure.
Run a job redirect its output to a file and allow the caller to decide what to do with failure .
pub fn run_redirect(&self, mut cmd: Command, stdout: &Path) -> Result<ExitStatus> {
        if self.args.verbose || self.args.dry_run {
            println!("{} > {}", render_command(&cmd).to_string_lossy(), stdout.display());
            if self.args.dry_run {
                // Short circuit. Difficult to mock an ExitStatus :(
                return Ok(<ExitStatus as std::os::unix::prelude::ExitStatusExt>::from_raw(0));
            }
        }
        let output_file = std::fs::File::create(&stdout)?;
        cmd.stdout(output_file);
        return cmd
            .status()
            .context(format!("Failed to invoke {}", cmd.get_program().to_string_lossy()));
    }
pub fn run_redirect ( & self , mut cmd : Command , stdout : & Path ) -> Result < ExitStatus > { if self . args . verbose || self . args . dry_run { println ! ( " " render_command ( cmd ) to_string_lossy ( ) stdout display ( ) ) ; if self . args . dry_run { // Short circuit. Difficult to mock an ExitStatus :( return Ok ( < ExitStatus as std :: os :: unix :: prelude :: ExitStatusExt > :: from_raw ( 0 ) ) ; } } let output_file = std :: fs :: File :: create ( & stdout ) ? ; cmd . stdout ( output_file ) ; return cmd . status ( ) . context ( format ! ( " " cmd get_program ( ) to_string_lossy ( ) ) ) ; }
Run a job, redirect its output to a file, and allow the caller to decide what to do with failure.
Run a job redirect its output to a file and allow the caller to decide what to do with failure .
&self
cmd
Command
stdout
&Path