diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index fcd9cfd..09dc892 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ use std::io::{self, Write}; use std::io::prelude::*; use std::net::TcpListener; +use std::process::Command; fn open_stream() -> io::Result<()> { let listener = TcpListener::bind("127.0.0.1:34254")?; @@ -11,7 +12,14 @@ fn open_stream() -> io::Result<()> { let mut url = String::new(); stream.read_to_string(&mut url)?; - println!("{}", url); + Command::new("open") + .arg("-a") + .arg("Opera") + + // Trim the trailing newline, otherwise this doesn't + // work + .arg(&url.trim_right()) + .spawn()?; } Err(e) => { write!(io::stderr(), "{}", e)?; |