pub fn tap_available() -> bool {
    if std::env::consts::OS != "linux" {
        return false;
    }
    let output = Command::new("ip").args(["tuntap", "show"]).output();
    // Output contains the interface name, if it exists. Tap is considered available if the call
    // succeeds and output is non-empty.
    // TODO(fxbug.dev/87464): Check for the expected interface name, to make sure we have the right
    // one if there are multiple taps possible (i.e. for supporting multiple emu instances).
    return output.is_ok() && output.unwrap().stdout.len() > 0;
}
/// A utility function for testing if a Tap interface is up and available. Assumes the existence
/// of the "ip" program for finding the interface, which is usually preinstalled on Linux hosts
/// but not MacOS hosts. Conservatively assumes any error indicates Tap is unavailable.
A utility function for testing if a Tap interface is up and available. Assumes the existence
of the "ip" program for finding the interface, which is usually preinstalled on Linux hosts
but not MacOS hosts. Conservatively assumes any error indicates Tap is unavailable.
A utility function for testing if a Tap interface is up and available . Assumes the existence of the " ip " program for finding the interface which is usually preinstalled on Linux hosts but not MacOS hosts . Conservatively assumes any error indicates Tap is unavailable .
pub fn tap_available() -> bool {
    if std::env::consts::OS != "linux" {
        return false;
    }
    let output = Command::new("ip").args(["tuntap", "show"]).output();
    // Output contains the interface name, if it exists. Tap is considered available if the call
    // succeeds and output is non-empty.
    // TODO(fxbug.dev/87464): Check for the expected interface name, to make sure we have the right
    // one if there are multiple taps possible (i.e. for supporting multiple emu instances).
    return output.is_ok() && output.unwrap().stdout.len() > 0;
}
pub fn tap_available ( ) -> bool { if std :: env :: consts :: OS != " " { return false ; } let output = Command :: new ( " " ) . args ( [ " " , " " ] ) . output ( ) ; // Output contains the interface name, if it exists. Tap is considered available if the call // succeeds and output is non-empty. // TODO(fxbug.dev/87464): Check for the expected interface name, to make sure we have the right // one if there are multiple taps possible (i.e. for supporting multiple emu instances). return output . is_ok ( ) && output . unwrap ( ) . stdout . len ( ) > 0 ; }
A utility function for testing if a Tap interface is up and available.
A utility function for testing if a Tap interface is up and available .