Skip to main content

Crate bun_spawn_sys

Crate bun_spawn_sys 

Source
Expand description

bun_spawn_sys — raw OS process-spawn layer split out of bun_spawn.

This crate owns everything that talks directly to the kernel/libuv to create a child process and read its exit status, with no event-loop integration:

  • posix_spawn(2) libc wrappers (Actions/Attr/spawn_z/wait4)
  • the posix_spawn_bun repr(C) request structs and FFI decl
  • spawn_process_posix (fd plumbing + posix_spawn call)
  • PosixSpawnOptions/PosixStdio/PosixSpawnResult/ExtraPipe/ StdioKind/Dup2/Rusage
  • signal-forwarding / no-orphans extern "C" decls

Dependencies are deliberately leaf-only: libc, bun_sys, bun_core, bun_analytics, and (Windows-only) bun_libuv_sys. There is no bun_event_loop/bun_io/bun_io/bun_threading dependency — Process, Poller, WaiterThread, and the sync runner stay in bun_spawn and depend on this crate.

See docs/SPAWN_SYS_PROPOSAL.md for the full crate-graph rationale.

Re-exports§

pub use spawn_process::spawn_process_posix;
pub use spawn_process::Dup2;
pub use spawn_process::ExtraPipe;
pub use spawn_process::FdT;
pub use spawn_process::IoCounters;
pub use spawn_process::PidFdType;
pub use spawn_process::PidT;
pub use spawn_process::PosixSpawnOptions;
pub use spawn_process::PosixSpawnResult;
pub use spawn_process::PosixStdio;
pub use spawn_process::Rusage;
pub use spawn_process::RusageFields;
pub use spawn_process::StdioKind;
pub use spawn_process::WinRusage;
pub use spawn_process::WinTimeval;
pub use spawn_process::rusage_zeroed;

Modules§

ffi
pdeathsig
posix_spawn
posix_spawn(2) FFI wrappers (Actions / Attr / spawn_z / wait4). Port of src/runtime/api/bun/spawn.zig.
spawn_process
spawn_process_posix + option/result structs + Rusage. Split out of src/spawn/process.rs. Raw spawn_process_posix + option/result types — split out of bun_spawn::process so the fd/action plumbing has no event-loop dependency. Process/Poller/WaiterThread/sync stay in bun_spawn.
waiter_thread_flag

Type Aliases§

Argv
[*:null]?[*:0]const u8 — null-terminated array of NUL-terminated C strings (the argv shape posix_spawn/execve accept). Build as Vec<*const c_char> with a trailing core::ptr::null(), then .as_ptr().
CStrPtr
Element type for an owned Vec backing an Argv/Envp. Null is the sentinel; never wrap in Option.
Envp
Same shape as Argv for the environment block.