/// Convenience function that can be called from main and causes the Fuchsia process being
/// run over ssh to be terminated when the user hits control-C.
Convenience function that can be called from main and causes the Fuchsia process being
run over ssh to be terminated when the user hits control-C.
Convenience function that can be called from main and causes the Fuchsia process being run over ssh to be terminated when the user hits control - C .
pub fn wait_for_close() -> impl Future<Output = ()> {
    let (sender, receiver) = futures::channel::oneshot::channel();
    thread::spawn(move || loop {
        let mut input = [0; 1];
        match io::stdin().read_exact(&mut input) {
            Ok(()) => {}
            Err(_) => {
                let _ = sender.send(());
                break;
            }
        }
    });
    receiver.map(|_: Result<(), Canceled>| ())
}
pub fn wait_for_close ( ) -> impl Future < Output = ( ) > { let ( sender , receiver ) = futures :: channel :: oneshot :: channel ( ) ; thread :: spawn ( move | | loop { let mut input = [ 0 ; 1 ] ; match io :: stdin ( ) . read_exact ( & mut input ) { Ok ( ( ) ) => { } Err ( _ ) => { let _ = sender . send ( ( ) ) ; break ; } } } ) ; receiver . map ( | _ : Result < ( ) , Canceled > | ( ) ) }
Convenience function that can be called from main and causes the Fuchsia process being
run over ssh to be terminated when the user hits control-C.
Convenience function that can be called from main and causes the Fuchsia process being run over ssh to be terminated when the user hits control - C .