diff --git a/alert.rc b/alert.rc index 69a3ac4..0b75e11 100644 --- a/alert.rc +++ b/alert.rc @@ -11,9 +11,9 @@ #[crate_type = "lib"]; #[cfg(target_os="macos")] -extern mod core_foundation; +extern crate core_foundation; #[cfg(target_os="macos")] -extern mod cocoa; +extern crate cocoa; #[cfg(target_os="linux")] pub use linux::Alert; diff --git a/linux.rs b/linux.rs index d17c9ac..7934339 100644 --- a/linux.rs +++ b/linux.rs @@ -9,7 +9,7 @@ use AlertMethods; use std::io; -use std::io::buffered::BufferedReader; +use std::io::BufferedReader; /// An alert. pub struct Alert { @@ -23,9 +23,12 @@ impl AlertMethods for Alert { } fn add_prompt(&mut self) { - print("URL: "); - self.url = BufferedReader::new(io::stdin()) - .read_line().expect("Could not read URL from stdin"); + println!("URL: "); + self.url = match BufferedReader::new(io::stdin()).read_line() { + Ok(res) => res, + _ => fail!("Could not read URL from stdin"), + + } } fn run(&self) { diff --git a/test.rs b/test.rs index 43a7d06..037c1a5 100644 --- a/test.rs +++ b/test.rs @@ -20,13 +20,13 @@ use core::task; pub fn main() { let mut builder = task::task(); builder.sched_mode(PlatformThread); - do builder.spawn { + builder.spawn(|| { init(); let mut alert: Alert = AlertMethods::new("All units destroyed."); alert.add_prompt(); alert.run() - } + }); } #[cfg(target_os="macos")]