Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamjan Cvetko <damjan.cvetko@gmail.com>2022-03-15 02:39:26 +0300
committerGitHub <noreply@github.com>2022-03-15 02:39:26 +0300
commitc649573a2ab4866426d629088c6d5c989eaf8fd8 (patch)
tree45a41e0992fc718fbc3fcb866e22db018d99d713 /doc/api/child_process.md
parent64f542fb83424162a30b3c563009689c84d91737 (diff)
doc: clarify path search in `child_process.spawn`
The documentation about command lookup could be more clear and note differences between Windows and Linux/OSX. Current text gives the impression that if one passes `options.env` without `PATH`, the path search will fall back on `process.env.PATH`. In reality, passing environment without `PATH` to `execvp` causes it to look for the binary only in `/usr/bin:/bin`. Also Windows behaves different and more in line with the current documentation text. PR-URL: https://github.com/nodejs/node/pull/41418 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc/api/child_process.md')
-rw-r--r--doc/api/child_process.md7
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/api/child_process.md b/doc/api/child_process.md
index de988c25b07..ad712eb8786 100644
--- a/doc/api/child_process.md
+++ b/doc/api/child_process.md
@@ -36,8 +36,11 @@ identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`
option if the output will not be consumed.
The command lookup is performed using the `options.env.PATH` environment
-variable if it is in the `options` object. Otherwise, `process.env.PATH` is
-used.
+variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is
+used. If `options.env` is set without `PATH`, lookup on Unix is performed
+on a default search path search of `/usr/bin:/bin` (see your operating system's
+manual for execvpe/execvp), on Windows the current processes environment
+variable `PATH` is used.
On Windows, environment variables are case-insensitive. Node.js
lexicographically sorts the `env` keys and uses the first one that