Skip to content

Commit 0973bcc

Browse files
committed
Fail when there's an error starting a process. Close #1778.
1 parent d3712a2 commit 0973bcc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/libcore/run.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,10 @@ Spawns a process and waits for it to terminate
161161
The process id
162162
"]
163163
fn run_program(prog: str, args: [str]) -> int {
164-
ret waitpid(spawn_process(prog, args, none, none,
165-
0i32, 0i32, 0i32));
164+
let pid = spawn_process(prog, args, none, none,
165+
0i32, 0i32, 0i32);
166+
if pid == -1 as pid_t { fail; }
167+
ret waitpid(pid);
166168
}
167169

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

193-
if pid == -1i32 { fail; }
195+
if pid == -1 as pid_t { fail; }
194196
libc::close(pipe_input.in);
195197
libc::close(pipe_output.out);
196198
libc::close(pipe_err.out);

0 commit comments

Comments
 (0)