Function open::with

source ·
pub fn with(path: impl AsRef<OsStr>, app: impl Into<String>) -> Result<()>
Expand description

Open path with the given application.

This function may block if the application or launcher doesn’t detach itself. In that case, consider using with_in_background() or `with_command().

§Examples

let path = "http://rust-lang.org";
let app = "firefox";

match open::with(path, app) {
    Ok(()) => println!("Opened '{}' successfully.", path),
    Err(err) => panic!("An error occurred when opening '{}': {}", path, err),
}

§Errors

A std::io::Error is returned on failure. Because different operating systems handle errors differently it is recommend to not match on a certain error.