Skip to main content

Module bun_api

Module bun_api 

Source

Functions§

dispatch_exit_handlers
Invoke ‘exit’ listeners on the process object.
init_process_start
install_bun_global
install_bun_on_target
Install Bun.* namespace on a target object (REQ-SEC-002 parameter injection).
install_process_global
install_process_on_target
Install process.* namespace on a target object (REQ-SEC-002 parameter injection).
post_eval_drain_then_exit
PostEvalHook: drain the event loop (timers + I/O); when it is done — natural end or process.exit() requested — dispatch ‘exit’ listeners.
spawn_watch_loop_alive
Live exit watchers keep the event loop alive (Node active-handle semantics: a child process is a ref’d handle — await proc.exited must park the loop until the child is reaped, exactly like a pending timer). Called from timers::drain_and_check’s loop-alive verdict.
spawn_watch_pump_all
Drive every live Bun.spawn exit watcher on the JS thread. Called from timers::drain_and_check / drain_one_pass — the same integration point as cluster_pump_all. For each watched pid whose exit info is published (reaped + pipes drained), invokes the registered JS finish callback exactly once with (exitCode, signal) and drops the watch.