node:child_process API Reference

Subprocess helpers and Elide 1.5.0 lifecycle limitations

The synchronous subprocess helpers work in ordinary scripts:

import { execFileSync } from "node:child_process";

const output = execFileSync(process.execPath, [
  "--snippet",
  'process.stdout.write("hello")',
]);
console.log(output.toString()); // hello

Available exports are spawn, spawnSync, exec, execSync, execFile, execFileSync, fork, and ChildProcess. spawnSync returns the familiar object with pid, status, signal, stdout, stderr, and output.

Elide 1.5.0 limitations

The asynchronous surface is not reliable in one-shot scripts in Elide 1.5.0. A spawned process can start, but its stdout, callback, exit, and close events may not run before Elide exits. fork() creates a child handle, but IPC writes fail, so child.send() / process.send() should not be used.

Use the synchronous helpers when blocking is acceptable. In Elide 1.5.0, asynchronous subprocess handles do not participate reliably in the event-loop keep-alive lifecycle.

Process creation is controlled by --allow-run[=CMDS] and --deny-run <CMDS> when sandbox flags are active.