Add Out<T> wrapper
This commit is contained in:
@@ -26,6 +26,7 @@ use crate::{
|
||||
unistd,
|
||||
},
|
||||
io::{self, BufRead, BufWriter, LineWriter, Read, Write},
|
||||
out::Out,
|
||||
platform::{self, types::*, Pal, Sys, WriteByte, ERRNO},
|
||||
sync::Mutex,
|
||||
};
|
||||
@@ -826,6 +827,7 @@ pub unsafe extern "C" fn getw(stream: *mut FILE) -> c_int {
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn pclose(stream: *mut FILE) -> c_int {
|
||||
// TODO: rusty error handling?
|
||||
let pid = {
|
||||
let mut stream = (*stream).lock();
|
||||
|
||||
@@ -840,7 +842,7 @@ pub unsafe extern "C" fn pclose(stream: *mut FILE) -> c_int {
|
||||
fclose(stream);
|
||||
|
||||
let mut wstatus = 0;
|
||||
if Sys::waitpid(pid, &mut wstatus, 0).or_minus_one_errno() == -1 {
|
||||
if Sys::waitpid(pid, Some(Out::from_mut(&mut wstatus)), 0).or_minus_one_errno() == -1 {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user