doc: Clarify path search in child_process spawn#41418
Merged
aduh95 merged 4 commits intonodejs:masterfrom Mar 14, 2022
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
child_process: clarify path search in spawn(), explain difference between unix/win when PATH is not present in env option
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.envwithoutPATHthat the path search will fall back onprocess.env.PATH.However 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.
References:
https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/execvp.3.html
https://linux.die.net/man/3/execvp
node/deps/uv/src/unix/process.c
Line 337 in c61870c
node/deps/uv/src/win/process.c
Line 1017 in c61870c