doc: Clarify path search in child_process spawn
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.env
without PATH
that the path search will fall back on process.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
https://github.com/nodejs/node/blob/c61870c376e2f5b0dbaa939972c46745e21cdbdd/deps/uv/src/unix/process.c#L337 https://github.com/nodejs/node/blob/c61870c376e2f5b0dbaa939972c46745e21cdbdd/deps/uv/src/win/process.c#L1017