Commit c1c98fb1 authored by dr-js's avatar dr-js Committed by Antoine du Hamel
Browse files

doc,child_process: `pid` can be `undefined` when `ENOENT`



From the code `nodejs@8` and up should behave the same:
github.com/nodejs/node/blame/v8.17.0/lib/internal/child_process.js#L290

And a short test snippet:
```js
const { spawn } = require('child_process')

const subProcess = spawn('non-exist-command')
subProcess.on('error', (error) =>
	console.warn('mute Unhandled "error" event:', error))
console.log('- pid:', subProcess.pid)
process.nextTick(() => console.log('- after error emit'))
console.log('== end of test ==')
```

Note: the sync spawn result `pid` currently do not follow this pattern.

Co-authored-by: default avatarRich Trott <rtrott@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/37014


Reviewed-By: default avatarAntoine du Hamel <duhamelantoine1995@gmail.com>
parent 574590d5
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment