auto merge of #10132 : pcwalton/rust/proc, r=pcwalton
the feature gate for `once fn` if used with the `~` sigil. r? @brson
This commit is contained in:
commit
fed48cc861
29 changed files with 250 additions and 70 deletions
|
|
@ -649,23 +649,25 @@ fn waitpid(pid: pid_t) -> int {
|
|||
|
||||
unsafe {
|
||||
|
||||
let proc = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION, FALSE, pid as DWORD);
|
||||
if proc.is_null() {
|
||||
let process = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION,
|
||||
FALSE,
|
||||
pid as DWORD);
|
||||
if process.is_null() {
|
||||
fail!("failure in OpenProcess: {}", os::last_os_error());
|
||||
}
|
||||
|
||||
loop {
|
||||
let mut status = 0;
|
||||
if GetExitCodeProcess(proc, &mut status) == FALSE {
|
||||
CloseHandle(proc);
|
||||
if GetExitCodeProcess(process, &mut status) == FALSE {
|
||||
CloseHandle(process);
|
||||
fail!("failure in GetExitCodeProcess: {}", os::last_os_error());
|
||||
}
|
||||
if status != STILL_ACTIVE {
|
||||
CloseHandle(proc);
|
||||
CloseHandle(process);
|
||||
return status as int;
|
||||
}
|
||||
if WaitForSingleObject(proc, INFINITE) == WAIT_FAILED {
|
||||
CloseHandle(proc);
|
||||
if WaitForSingleObject(process, INFINITE) == WAIT_FAILED {
|
||||
CloseHandle(process);
|
||||
fail!("failure in WaitForSingleObject: {}", os::last_os_error());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ mod tests {
|
|||
let pipe_out = os::pipe();
|
||||
let pipe_err = os::pipe();
|
||||
|
||||
let mut proc = run::Process::new("cat", [], run::ProcessOptions {
|
||||
let mut process = run::Process::new("cat", [], run::ProcessOptions {
|
||||
dir: None,
|
||||
env: None,
|
||||
in_fd: Some(pipe_in.input),
|
||||
|
|
@ -430,7 +430,7 @@ mod tests {
|
|||
}
|
||||
let actual = readclose(pipe_out.input);
|
||||
readclose(pipe_err.input);
|
||||
proc.finish();
|
||||
process.finish();
|
||||
|
||||
assert_eq!(~"test", actual);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue