fn exec_args(service: &Service) -> Result<(CString, Vec<CString>, Vec<CString>)> {
    let chunks: Vec<String> = shlex::split(service.command.as_ref()).ok_or_else(|| {
        std::io::Error::new(
            std::io::ErrorKind::InvalidInput,
            format!("Invalid command: {}", service.command,),
        )
    })?;
    let program_name = CString::new(chunks.get(0).unwrap().as_str())?;
    let to_cstring = |s: Vec<String>| {
        s.into_iter()
            .map(|arg| CString::new(arg).map_err(Into::into))
            .collect::<Result<Vec<_>>>()
    };
    let arg_cstrings = to_cstring(chunks)?;
    let environment = service.get_environment()?;
    let env_cstrings = to_cstring(environment)?;

    Ok((program_name, arg_cstrings, env_cstrings))
}
/// Creates the execvpe arguments out of a Service
Creates the execvpe arguments out of a Service
Creates the execvpe arguments out of a Service
fn exec_args(service: &Service) -> Result<(CString, Vec<CString>, Vec<CString>)> {
    let chunks: Vec<String> = shlex::split(service.command.as_ref()).ok_or_else(|| {
        std::io::Error::new(
            std::io::ErrorKind::InvalidInput,
            format!("Invalid command: {}", service.command,),
        )
    })?;
    let program_name = CString::new(chunks.get(0).unwrap().as_str())?;
    let to_cstring = |s: Vec<String>| {
        s.into_iter()
            .map(|arg| CString::new(arg).map_err(Into::into))
            .collect::<Result<Vec<_>>>()
    };
    let arg_cstrings = to_cstring(chunks)?;
    let environment = service.get_environment()?;
    let env_cstrings = to_cstring(environment)?;
    Ok((program_name, arg_cstrings, env_cstrings))
}
fn exec_args ( service : & Service ) -> Result < ( CString , Vec < CString > , Vec < CString > ) > { let chunks : Vec < String > = shlex :: split ( service . command . as_ref ( ) ) . ok_or_else ( | | { std :: io :: Error :: new ( std :: io :: ErrorKind :: InvalidInput , format ! ( " " service command ) , ) } ) ? ; let program_name = CString :: new ( chunks . get ( 0 ) . unwrap ( ) . as_str ( ) ) ? ; let to_cstring = | s : Vec < String > | { s . into_iter ( ) . map ( | arg | CString :: new ( arg ) . map_err ( Into :: into ) ) . collect :: < Result < Vec < _ > > > ( ) } ; let arg_cstrings = to_cstring ( chunks ) ? ; let environment = service . get_environment ( ) ? ; let env_cstrings = to_cstring ( environment ) ? ; Ok ( ( program_name , arg_cstrings , env_cstrings ) ) }
Creates the execvpe arguments out of a Service
Creates the execvpe arguments out of a Service
service
&Service
service
&Service