pub fn spawn(&mut self, remaining_args: &[OsString]) -> anyhow::Result<()> {
        if self.children.len() >= self.max_children {
            // TODO: Naive as the oldest child is not necessarily the one that will end up first.
            let mut child = self.children.swap_remove(0);
            child.wait()?;
            // TODO: log error/bail out if the child failed.
        }
        let child = Command::new(&self.cmd)
            .args(&self.initial_args)
            .args(remaining_args)
            .stdin(Stdio::null())
            .spawn()
            .context("Can not start child process")?;
        self.children.push(child);
        Ok(())
    }
/// Runs a child process with the arguments specified in `new()` and `remaining_args`.
///
/// May block if the maximum number of processes has been reached.
Runs a child process with the arguments specified in `new()` and `remaining_args`.
May block if the maximum number of processes has been reached.
Runs a child process with the arguments specified in ` new () ` and ` remaining_args ` . May block if the maximum number of processes has been reached .
pub fn spawn(&mut self, remaining_args: &[OsString]) -> anyhow::Result<()> {
        if self.children.len() >= self.max_children {
            // TODO: Naive as the oldest child is not necessarily the one that will end up first.
            let mut child = self.children.swap_remove(0);
            child.wait()?;
            // TODO: log error/bail out if the child failed.
        }
        let child = Command::new(&self.cmd)
            .args(&self.initial_args)
            .args(remaining_args)
            .stdin(Stdio::null())
            .spawn()
            .context("Can not start child process")?;
        self.children.push(child);
        Ok(())
    }
pub fn spawn ( & mut self , remaining_args : & [ OsString ] ) -> anyhow :: Result < ( ) > { if self . children . len ( ) >= self . max_children { // TODO: Naive as the oldest child is not necessarily the one that will end up first. let mut child = self . children . swap_remove ( 0 ) ; child . wait ( ) ? ; // TODO: log error/bail out if the child failed. } let child = Command :: new ( & self . cmd ) . args ( & self . initial_args ) . args ( remaining_args ) . stdin ( Stdio :: null ( ) ) . spawn ( ) . context ( " " ) ? ; self . children . push ( child ) ; Ok ( ( ) ) }
Runs a child process with the arguments specified in `new()` and `remaining_args`.
Runs a child process with the arguments specified in ` new () ` and ` remaining_args ` .
&mut self
remaining_args
&[OsString]
&mut self
remaining_args
&[OsString]