# require-child-process-timeout

Rule `node/require-child-process-timeout`. Require a timeout or signal for child processes

- Source: node
- Technologies: Node.js
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1996 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `n/require-child-process-timeout` | no | no | package `eslint-plugin-n` | [docs](https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/require-child-process-timeout.md) |

## Code examples

### Incorrect: the rule reports this

```js
import { execSync, execFile, spawn } from "node:child_process"
import { promisify } from "node:util"

execSync("docker ps")
promisify(execFile)("gh", ["api", "user"])
spawn("docker", ["logs", "-f", "container"], { timeout: 0 })
```

### Correct: the rule accepts this

```js
import { execSync, execFile, spawn } from "node:child_process"
import { promisify } from "node:util"

execSync("docker ps", { timeout: 10_000 })
promisify(execFile)("gh", ["api", "user"], { timeout: 60_000 })
spawn("docker", ["logs", "-f", "container"], {
    signal: AbortSignal.timeout(60_000),
})
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import n from "eslint-plugin-n";

export default [
  {
    plugins: { n },
    rules: {
      "n/require-child-process-timeout": "error",
    },
  },
];
```

## Related rules

- [node/prefer-promises/fs](https://lintradar.dev/rules/node/prefer-promises/fs.md): Enforce `require("fs").promises`
- [node/prefer-promises/dns](https://lintradar.dev/rules/node/prefer-promises/dns.md): Enforce `require("dns").promises`
- [node/prefer-import/assert-strict](https://lintradar.dev/rules/node/prefer-import/assert-strict.md): Enforce using `node:assert/strict` instead of `node:assert`.
- [node/prefer-global/url-search-params](https://lintradar.dev/rules/node/prefer-global/url-search-params.md): Enforce either `URLSearchParams` or `require("url").URLSearchParams`
- [node/prefer-global/url](https://lintradar.dev/rules/node/prefer-global/url.md): Enforce either `URL` or `require("url").URL`
- [node/prefer-global/timers](https://lintradar.dev/rules/node/prefer-global/timers.md): Enforce either global timer functions or `require("timers")`

---

Web page: https://lintradar.dev/rules/node/require-child-process-timeout. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
