Skip to main content
ChildProcess.prototype.pid - node__child_process.d.ts - Node documentation
property ChildProcess.prototype.pid

Usage in Deno

```typescript import { ChildProcess } from "node:node__child_process.d.ts"; ```
Returns the process identifier (PID) of the child process. If the child process fails to spawn due to errors, then the value is `undefined` and `error` is emitted. ```js import { spawn } from 'node:child_process'; const grep = spawn('grep', ['ssh']); console.log(`Spawned child pid: ${grep.pid}`); grep.stdin.end(); ```

Type

number | undefined