Skip to content

Commit

Permalink
auto merge of rust-lang#9471 : brson/rust/rustexit, r=thestinger
Browse files Browse the repository at this point in the history
This appears to eliminate the common errors with assertions failures
in rust_initialize_rt_tls_key.
  • Loading branch information
bors committed Sep 24, 2013
2 parents 7535479 + 5e6a8ea commit e3624ed
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/librust/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ extern mod rustc;
use std::io;
use std::os;
use std::run;
use std::libc::exit;

enum ValidUsage {
Valid(int), Invalid
Expand Down Expand Up @@ -235,7 +234,7 @@ pub fn main() {

if (os_args.len() > 1 && (os_args[1] == ~"-v" || os_args[1] == ~"--version")) {
rustc::version(os_args[0]);
unsafe { exit(0); }
return;
}

let args = os_args.tail();
Expand All @@ -245,8 +244,11 @@ pub fn main() {
for command in r.iter() {
let result = do_command(command, args.tail());
match result {
Valid(exit_code) => unsafe { exit(exit_code.to_i32()) },
_ => loop
Valid(exit_code) => {
os::set_exit_status(exit_code);
return;
}
_ => loop
}
}
}
Expand Down

0 comments on commit e3624ed

Please sign in to comment.