Skip to content

Commit

Permalink
Fail when there's an error starting a process. Close #1778.
Browse files Browse the repository at this point in the history
  • Loading branch information
graydon committed Mar 20, 2012
1 parent d3712a2 commit 0973bcc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/libcore/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@ Spawns a process and waits for it to terminate
The process id
"]
fn run_program(prog: str, args: [str]) -> int {
ret waitpid(spawn_process(prog, args, none, none,
0i32, 0i32, 0i32));
let pid = spawn_process(prog, args, none, none,
0i32, 0i32, 0i32);
if pid == -1 as pid_t { fail; }
ret waitpid(pid);
}

#[doc ="
Expand Down Expand Up @@ -190,7 +192,7 @@ fn start_program(prog: str, args: [str]) -> program {
pipe_input.in, pipe_output.out,
pipe_err.out);

if pid == -1i32 { fail; }
if pid == -1 as pid_t { fail; }
libc::close(pipe_input.in);
libc::close(pipe_output.out);
libc::close(pipe_err.out);
Expand Down

0 comments on commit 0973bcc

Please sign in to comment.