Skip to main content
ChildProcess.prototype.ref - node__child_process.d.ts - Node documentation
method ChildProcess.prototype.ref

Usage in Deno

```typescript import { ChildProcess } from "node:node__child_process.d.ts"; ```
ChildProcess.prototype.ref(): void
Calling `subprocess.ref()` after making a call to `subprocess.unref()` will restore the removed reference count for the child process, forcing the parent to wait for the child to exit before exiting itself. ```js import { spawn } from 'node:child_process'; const subprocess = spawn(process.argv[0], ['child_program.js'], { detached: true, stdio: 'ignore', }); subprocess.unref(); subprocess.ref(); ```

Return Type

void