---
source: https://iinventedlight.com/library/notes/node-child-process.md
title: "child_process.spawn starts a subprocess without blocking the event loop"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (Node.js docs); MIT (nodejs/node (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Node.js, Child process, MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors; nodejs/node (GitHub), child_process.md (Node.js source docs), MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-17
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-17
as_of: 2026-11-17
confidence: medium
untested: "Not reproduced (2026-11-17). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: Node.js child_process"
tags: [nodejs, child_process, spawn, exec, fork]
client: Librarian
sources:
  - id: S1
    title: "Child process"
    publisher: Node.js
    url: https://nodejs.org/api/child_process.html
    accessed: 2026-11-17
    license: "MIT"
  - id: S2
    title: "child_process.md (Node.js source docs)"
    publisher: nodejs/node (GitHub)
    url: https://github.com/nodejs/node/blob/main/doc/api/child_process.md
    accessed: 2026-11-17
    license: "MIT"
---
# child_process.spawn starts a subprocess without blocking the event loop
**Answer:** `child_process.spawn()` starts a subprocess asynchronously and does not block the Node.js event loop. The `node:child_process` module also offers `exec`, `execFile`, `fork`, and synchronous counterparts built on `spawn` or `spawnSync`. Each asynchronous method returns a `ChildProcess` object.

## spawn, exec, and fork

`exec` spawns a shell and runs a command in that shell, then passes `stdout` and `stderr` to a callback. `execFile` is similar but, by default, runs the command directly without first spawning a shell. `fork` starts a new Node.js process and sets up an IPC channel so the parent and child can send messages.

`spawnSync`, `execSync`, and `execFileSync` block the event loop until the child exits. The synchronous counterparts may be more convenient, but the synchronous methods can have significant impact on performance due to stalling the event loop.

## stdio pipes

By default the parent and child get pipes for `stdin`, `stdout`, and `stderr`. Those pipes have limited capacity. If the child writes more than the pipe can hold and the parent does not read it, the child can block. Use `{ stdio: 'ignore' }` when the output will not be consumed.

## See also

- [node-process-and-console](https://iinventedlight.com/library/notes/node-process-and-console/)
- [node-events](https://iinventedlight.com/library/notes/node-events/)
- [node-async-local-storage](https://iinventedlight.com/library/notes/node-async-local-storage/)
- [node-buffer](https://iinventedlight.com/library/notes/node-buffer/)

## Claims

- id: C1
  claim: spawn starts the child process asynchronously without blocking the event loop.
  source: S1
  evidence: "spawns the child process asynchronously"

- id: C2
  claim: The module's main way to start a subprocess is child_process.spawn().
  source: S1
  evidence: "primarily provided by the child_process.spawn() function"

- id: C3
  claim: exec spawns a shell and runs a command inside it.
  source: S2
  evidence: "spawns a shell and runs a command within that"

- id: C4
  claim: fork starts a new Node.js process with an IPC channel.
  source: S2
  evidence: "spawns a new Node.js process and invokes a"

## Sources

- [S1] Child process. Node.js. https://nodejs.org/api/child_process.html . License: MIT. Accessed 2026-11-17.

- [S2] child_process.md (Node.js source docs). nodejs/node (GitHub). https://github.com/nodejs/node/blob/main/doc/api/child_process.md . License: MIT. Accessed 2026-11-17.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Node.js, Child process, MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors; nodejs/node (GitHub), child_process.md (Node.js source docs), MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
