From 9e0f53045dbb13adb3c6921f02186e0bec30b939 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Wed, 4 Mar 2020 19:17:27 +0200 Subject: [PATCH 1/3] doc: clear up child_process command resolution Fixes: https://github.com/nodejs/node/issues/20605 Refs: https://github.com/libuv/libuv/pull/1837 --- 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 0a7d65eef4a135..ce738bd577c66e 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-insensitivety 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 From fc5786389f29526c1f5227605e2f8196e527c8bb Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Wed, 4 Mar 2020 20:06:43 +0200 Subject: [PATCH 2/3] fixup! update doc/api/child_process.md Co-Authored-By: Anna Henningsen --- doc/api/child_process.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index ce738bd577c66e..04cb65ed3439ff 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -37,7 +37,7 @@ 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-insensitivety matching `'PATH'` to perform command lookup. +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. From 5926380800975a381789c6e21ff7da36f54b5912 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Wed, 11 Mar 2020 12:58:41 +0200 Subject: [PATCH 3/3] fixup! Update doc/api/child_process.md --- doc/api/child_process.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 04cb65ed3439ff..58306dd2f0163b 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -37,7 +37,7 @@ 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. +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.