diff options
author | Bartosz Sosnowski <bartosz@janeasystems.com> | 2020-09-24 19:25:18 +0300 |
---|---|---|
committer | Bartosz Sosnowski <bartosz@janeasystems.com> | 2020-09-24 19:25:18 +0300 |
commit | abd8cdfc4e7d0d7f563a9b0f91523fe8395d5e25 (patch) | |
tree | 450b5f701a14a1c425811c9dd7db1c31b948b87a /doc/api/child_process.md | |
parent | e36ffb72bebae55091304da51837ca204367dc16 (diff) |
win, child_process: sanitize env variables
On Windows environment variables are case-insensitive. When spawning
child process certain apps can get confused if some of the variables are
duplicated.
This adds a step on Windows to normalizeSpawnArguments that removes such
duplicates, keeping only the first (in lexicographic order) entry in the
env key of options. This is partly already done for the PATH entry.
Fixes: https://github.com/nodejs/node/issues/35129
PR-URL: https://github.com/nodejs/node/pull/35210
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Diffstat (limited to 'doc/api/child_process.md')
-rw-r--r-- | doc/api/child_process.md | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 3a5f64d6228..235a2a80e71 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -43,6 +43,10 @@ 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. +On Windows Node.js will sanitize the `env` by removing case-insensitive +duplicates. Only first (in lexicographic order) entry will be passed to the +child process. + 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 |