Skip to main content

spawn_worker

Function spawn_worker 

Source
pub fn spawn_worker(php: &str, script: &str) -> Result<SpawnedWorker>
Expand description

Spawn a PHP worker process.

Sets FOLK_RUNTIME=pipe, FOLK_TASK_FD=3, FOLK_CONTROL_FD=4 in the environment. The child receives a connected Unix socket on each of FD 3 and FD 4.

§Safety

Calls pre_exec which runs libc::dup2 and libc::close in the child after fork but before exec. This is safe here because:

  • We only use async-signal-safe functions (dup2, close, fcntl).
  • We do not allocate or use Rust data structures in the callback.