fn collect_env() -> Vec<std::ffi::CString> {
    use std::os::unix::ffi::OsStrExt;
    std::env::vars_os()
        .map(|(key, value)| {
            std::ffi::CString::new(
                [
                    key.as_os_str().as_bytes(),
                    &[b'='],
                    value.as_os_str().as_bytes(),
                ]
                .concat(),
            )
            .unwrap()
        })
        .collect::<Vec<std::ffi::CString>>()
}
// Collects environment variables as vector of strings of "key=value"
// pairs (as is expected on process spawn).
Collects environment variables as vector of strings of "key=value"
pairs (as is expected on process spawn).
Collects environment variables as vector of strings of " key = value " pairs ( as is expected on process spawn ) .
fn collect_env() -> Vec<std::ffi::CString> {
    use std::os::unix::ffi::OsStrExt;
    std::env::vars_os()
        .map(|(key, value)| {
            std::ffi::CString::new(
                [
                    key.as_os_str().as_bytes(),
                    &[b'='],
                    value.as_os_str().as_bytes(),
                ]
                .concat(),
            )
            .unwrap()
        })
        .collect::<Vec<std::ffi::CString>>()
}
fn collect_env ( ) -> Vec < std :: ffi :: CString > { use std :: os :: unix :: ffi :: OsStrExt ; std :: env :: vars_os ( ) . map ( | ( key , value ) | { std :: ffi :: CString :: new ( [ key . as_os_str ( ) . as_bytes ( ) , & [ b'=' ] , value . as_os_str ( ) . as_bytes ( ) , ] . concat ( ) , ) . unwrap ( ) } ) . collect :: < Vec < std :: ffi :: CString > > ( ) }
Collects environment variables as vector of strings of "key=value"
pairs (as is expected on process spawn).
Collects environment variables as vector of strings of " key = value " pairs ( as is expected on process spawn ) .