diff options
-rw-r--r-- | examples/client.rs | 5 | ||||
-rw-r--r-- | src/lib.rs | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/examples/client.rs b/examples/client.rs index 0419816..a48d2a6 100644 --- a/examples/client.rs +++ b/examples/client.rs @@ -1,4 +1,5 @@ extern crate irc; +extern crate libc; use std::io::stdio; @@ -27,7 +28,7 @@ fn main() { match line { Ok(s) => { match from_str(s.as_slice()) { - Some(msg) => sender.send(msg), + Some(msg) => { if sender.send_opt(msg).is_err() { break; } }, None => () } } @@ -39,4 +40,6 @@ fn main() { for msg in rx.iter() { println!("{} {}", msg.prefix, msg.command); } + + unsafe { libc::exit(0); } } @@ -93,8 +93,7 @@ impl IrcClient <state::Disconnected> { }, Err(IoError{kind: std::io::TimedOut, ..}) => continue, Err(e) => { - println!("Unable to read line: {}", e); - break; + fail!("Unable to read line: {}", e); } } } |