You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
child_process spawn does not pass environment key-value pairs on Windows #34667
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. This may lead to issues on Windows when passing objects to env option that have multiple variants of PATH variable.
thanks, @richardlau, for providing the root cause.
what is your recommendation how to change PATH environment variable? should different casing variants be deleted during object copying? or is there a better API how to do it?
thanks, @richardlau, for providing the root cause.
what is your recommendation how to change PATH environment variable? should different casing variants be deleted during object copying? or is there a better API how to do it?
There should only be one variant of PATH in process.env as it has accessors to handle case insensitivity on Windows. So something like this should work on Windows:
Activity
richardlau commentedon Aug 7, 2020
This is probably a duplicate of #20605 and the copied
envobject contains a variant ofPATHwith different casing (e.g.Path).The documentation was updated (#32091) to say:
bnoordhuis commentedon Aug 10, 2020
I'll close this as answered. Let me know if it should be reopened.
beliayeu commentedon Aug 12, 2020
thanks, @richardlau, for providing the root cause.
what is your recommendation how to change PATH environment variable? should different casing variants be deleted during object copying? or is there a better API how to do it?
cc: @bnoordhuis
richardlau commentedon Aug 12, 2020
There should only be one variant of
PATHinprocess.envas it has accessors to handle case insensitivity on Windows. So something like this should work on Windows:Get evnVars['Path'] before calling spawn since it is modified on Wind…