Merge branch 'unwind'
Conflicts: src/comp/middle/trans.rs src/comp/middle/trans_build.rs src/lib/run_program.rs src/test/compiletest/runtest.rs
This commit is contained in:
commit
393deeb06f
49 changed files with 491 additions and 106 deletions
|
|
@ -6,6 +6,7 @@ export run_program;
|
|||
export start_program;
|
||||
export program_output;
|
||||
export spawn_process;
|
||||
export waitpid;
|
||||
|
||||
native "rust" mod rustrt {
|
||||
fn rust_run_program(argv: *sbuf, in_fd: int, out_fd: int, err_fd: int) ->
|
||||
|
|
@ -33,7 +34,7 @@ fn spawn_process(prog: str, args: [str], in_fd: int, out_fd: int, err_fd: int)
|
|||
}
|
||||
|
||||
fn run_program(prog: str, args: [str]) -> int {
|
||||
ret os::waitpid(spawn_process(prog, args, 0, 0, 0));
|
||||
ret waitpid(spawn_process(prog, args, 0, 0, 0));
|
||||
}
|
||||
|
||||
type program =
|
||||
|
|
@ -87,7 +88,7 @@ fn start_program(prog: str, args: [str]) -> @program_res {
|
|||
if finished { ret 0; }
|
||||
finished = true;
|
||||
self.close_input();
|
||||
ret os::waitpid(pid);
|
||||
ret waitpid(pid);
|
||||
}
|
||||
fn destroy() {
|
||||
self.finish();
|
||||
|
|
@ -117,6 +118,44 @@ fn program_output(prog: str, args: [str]) ->
|
|||
out: read_all(pr.output()),
|
||||
err: read_all(pr.err())};
|
||||
}
|
||||
|
||||
/* Returns an exit status */
|
||||
#[cfg(target_os = "win32")]
|
||||
fn waitpid(pid: int) -> int {
|
||||
os::waitpid(pid)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
fn waitpid(pid: int) -> int {
|
||||
#[cfg(target_os = "linux")]
|
||||
fn WIFEXITED(status: int) -> bool {
|
||||
(status & 0xff) == 0
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn WIFEXITED(status: int) -> bool {
|
||||
(status & 0x7f) == 0
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn WEXITSTATUS(status: int) -> int {
|
||||
(status >> 8) & 0xff
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn WEXITSTATUS(status: int) -> int {
|
||||
status >> 8
|
||||
}
|
||||
|
||||
let status = os::waitpid(pid);
|
||||
ret if WIFEXITED(status) {
|
||||
WEXITSTATUS(status)
|
||||
} else {
|
||||
1
|
||||
};
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
// mode: rust
|
||||
// fill-column: 78;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ export configure_test_task;
|
|||
export joinable;
|
||||
|
||||
native "rust" mod rustrt {
|
||||
fn hack_allow_leaks();
|
||||
fn sched_threads() -> uint;
|
||||
}
|
||||
|
||||
|
|
@ -324,12 +323,6 @@ fn configure_test_task() {
|
|||
// If this task fails we don't want that failure to propagate to the
|
||||
// test runner or else we couldn't keep running tests
|
||||
task::unsupervise();
|
||||
|
||||
// FIXME (236): Hack supreme - unwinding doesn't work yet so if this
|
||||
// task fails memory will not be freed correctly. This turns off the
|
||||
// sanity checks in the runtime's memory region for the task, so that
|
||||
// the test runner can continue.
|
||||
rustrt::hack_allow_leaks();
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue