From af73ed632c78d07ae7010fc73b6df245578c7f09 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Wed, 4 Mar 2020 19:17:27 +0200 Subject: [PATCH] doc: clear up child_process command resolution Fixes: https://github.com/nodejs/node/issues/20605 Refs: https://github.com/libuv/libuv/pull/1837 PR-URL: https://github.com/nodejs/node/pull/32091 Reviewed-By: Richard Lau Reviewed-By: Bartosz Sosnowski Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater --- doc/api/child_process.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 2baa98f06f516a..137c6901d24632 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -33,6 +33,14 @@ process will block waiting for the pipe buffer to accept more data. This is identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }` option if the output will not be consumed. +The command lookup will be performed using `options.env.PATH` environment +variable if passed in `options` object, otherwise `process.env.PATH` will be +used. To account for the fact that Windows environment variables are +case-insensitive Node.js will lexicographically sort all `env` keys and choose +the first one case-insensitively matching `PATH` to perform command lookup. +This may lead to issues on Windows when passing objects to `env` option that +have multiple variants of `PATH` variable. + The [`child_process.spawn()`][] method spawns the child process asynchronously, without blocking the Node.js event loop. The [`child_process.spawnSync()`][] function provides equivalent functionality in a synchronous manner that blocks