fn collect_and_send_logs(
        name: String,
        logger_socket: zx::Socket,
        mut sender: mpsc::Sender<TestEvent>,
    ) -> Option<BoxFuture<'static, Result<(), anyhow::Error>>> {
        if logger_socket.is_invalid_handle() {
            return None;
        }

        let mut ls = match LoggerStream::new(logger_socket) {
            Err(e) => {
                fx_log_err!("Logger: Failed to create fuchsia async socket: {:?}", e);
                return None;
            }
            Ok(ls) => ls,
        };

        let f = async move {
            while let Some(log) = ls
                .try_next()
                .await
                .map_err(|e| format_err!("Error while reading log msg: {}", e))?
            {
                sender
                    .send(TestEvent::LogMessage { test_case_name: name.clone(), msg: log })
                    .map_err(|e| format_err!("Error while sending log msg: {}", e))
                    .await?
            }
            Ok(())
        };

        let (remote, remote_handle) = f.remote_handle();
        fasync::spawn(remote);
        Some(remote_handle.boxed())
    }
/// Internal method that put a listener on `logger_socket`, process and send logs asynchronously
/// in the background.
Internal method that put a listener on `logger_socket`, process and send logs asynchronously
in the background.
Internal method that put a listener on ` logger_socket ` process and send logs asynchronously in the background .
fn collect_and_send_logs(
        name: String,
        logger_socket: zx::Socket,
        mut sender: mpsc::Sender<TestEvent>,
    ) -> Option<BoxFuture<'static, Result<(), anyhow::Error>>> {
        if logger_socket.is_invalid_handle() {
            return None;
        }
        let mut ls = match LoggerStream::new(logger_socket) {
            Err(e) => {
                fx_log_err!("Logger: Failed to create fuchsia async socket: {:?}", e);
                return None;
            }
            Ok(ls) => ls,
        };
        let f = async move {
            while let Some(log) = ls
                .try_next()
                .await
                .map_err(|e| format_err!("Error while reading log msg: {}", e))?
            {
                sender
                    .send(TestEvent::LogMessage { test_case_name: name.clone(), msg: log })
                    .map_err(|e| format_err!("Error while sending log msg: {}", e))
                    .await?
            }
            Ok(())
        };
        let (remote, remote_handle) = f.remote_handle();
        fasync::spawn(remote);
        Some(remote_handle.boxed())
    }
fn collect_and_send_logs ( name : String , logger_socket : zx :: Socket , mut sender : mpsc :: Sender < TestEvent > , ) -> Option < BoxFuture < ' static , Result < ( ) , anyhow :: Error > > > { if logger_socket . is_invalid_handle ( ) { return None ; } let mut ls = match LoggerStream :: new ( logger_socket ) { Err ( e ) => { fx_log_err ! ( " " e ) ; return None ; } Ok ( ls ) => ls , } ; let f = async move { while let Some ( log ) = ls . try_next ( ) . await . map_err ( | e | format_err ! ( " " e ) ) ? { sender . send ( TestEvent :: LogMessage { test_case_name : name . clone ( ) , msg : log } ) . map_err ( | e | format_err ! ( " " e ) ) . await ? } Ok ( ( ) ) } ; let ( remote , remote_handle ) = f . remote_handle ( ) ; fasync :: spawn ( remote ) ; Some ( remote_handle . boxed ( ) ) }
Internal method that put a listener on `logger_socket`, process and send logs asynchronously
in the background.
Internal method that put a listener on ` logger_socket ` process and send logs asynchronously in the background .
name
String
logger_socket
zx::Socket
sender
mpsc::Sender<TestEvent>
name
String
logger_socket
zx::Socket
sender
mpsc::Sender<TestEvent>