GeezerVison is showing github.com — doc: clear up child_process command resolution · nodejs/node@11899f6
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: doc/api/child_process.md +8Lines changed: 8 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -33,6 +33,14 @@ process will block waiting for the pipe buffer to accept more data. This is |
33 | 33 | identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }` |
34 | 34 | option if the output will not be consumed. |
35 | 35 |
|
| 36 | +The command lookup will be performed using `options.env.PATH` environment |
| 37 | +variable if passed in `options` object, otherwise `process.env.PATH` will be |
| 38 | +used. To account for the fact that Windows environment variables are |
| 39 | +case-insensitive Node.js will lexicographically sort all `env` keys and choose |
| 40 | +the first one case-insensitively matching `PATH` to perform command lookup. |
| 41 | +This may lead to issues on Windows when passing objects to `env` option that |
| 42 | +have multiple variants of `PATH` variable. |
| 43 | + |
36 | 44 | The [`child_process.spawn()`][] method spawns the child process asynchronously, |
37 | 45 | without blocking the Node.js event loop. The [`child_process.spawnSync()`][] |
38 | 46 | function provides equivalent functionality in a synchronous manner that blocks |
|