plat/process_apple.rs (Apple)#
Source: lib/plat/process_apple.rs
macOS and iOS child processes through posix_spawn (docs/APPLE.md): no fork in a process with threads.
A child gets its pipes on 0, 1 and 2, a process group of its own (killed as one, as on Linux),
SIGPIPE back at its default and no blocked signals, and none of this process's other descriptors
(POSIX_SPAWN_CLOEXEC_DEFAULT). posix_spawn reports a failed exec itself. iOS allows no child
processes: there every start fails with the system's error.
struct ChildNative child with independent output pipes; drop terminates its process group.
impl Child
fn read_stdout(&mut self, bytes: &mut [u8]) -> Result<Option<usize>, u32>Read stdout without waiting; None means no data, Some(0) means EOF.fn read_stderr(&mut self, bytes: &mut [u8]) -> Result<Option<usize>, u32>Read stderr without waiting; None means no data, Some(0) means EOF.fn write_stdin(&mut self, bytes: &[u8]) -> Result<Option<usize>, u32>Write available bytes; retry None or the unwritten suffix.fn id(&self) -> u32The child's process id (as plat::process_alive takes it).fn close_stdin(&mut self)Close stdin to request orderly helper shutdown.fn try_wait(&mut self) -> Result<Option<i32>, u32>Poll exit status; signals map to 128 + signal.fn terminate(&mut self)Terminate the owned process group and reap its leader.