Add Out<T> wrapper

This commit is contained in:
Jacob Lorentzon
2025-09-21 14:36:12 +02:00
parent 3ad1ba516e
commit 9c5f11fbc8
21 changed files with 469 additions and 195 deletions
+3 -1
View File
@@ -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;
}