Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: clarify utilityProcess child.pid value #44339

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion docs/api/utility-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,21 @@ true if the kill is successful, and false otherwise.
#### `child.pid`

A `Integer | undefined` representing the process identifier (PID) of the child process.
If the child process fails to spawn due to errors, then the value is `undefined`. When
Until the child process has spawned successfully, the value is `undefined`. When
the child process exits, then the value is `undefined` after the `exit` event is emitted.

```js
const child = utilityProcess.fork(path.join(__dirname, 'test.js'))

child.on('spawn', () => {
console.log(child.pid) // Integer
})

child.on('exit', () => {
console.log(child.pid) // undefined
})
```

#### `child.stdout`

A `NodeJS.ReadableStream | null` that represents the child process's stdout.
Expand Down