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
If you don't have a default Node selected and have no Node available elsewhere on the system, running node on Windows results in the error message:
'node' is not recognized as an internal or external command, operable program or batch file
I believe this is the result of the passthrough calling node with the non-Volta path. On Unix, calling a non-existent command results in the call to Command::status returning an Err. On Windows, it results in an Ok with a status code of 1. If possible, we should detect this situation and show the Volta error.
One possibility would be to use which to see if there is something on the system path named node and only pass through if that succeeds.
The text was updated successfully, but these errors were encountered:
Thinking more, this may be a combination of the passthrough command and the fact that on Windows we currently always use cmd.exe /C <command> when executing a Command. For passthrough cases, it may be better to create a direct command.
Further investigation reveals the above solution won't work. Apparently by default, Windows uses the PATH from the parent process (in this case the Volta shim) to look up an executable when using std::process::Command (see rust-lang/rust#15149). In order to combat that, if you set a PATH environment variable, Rust internally does a lookup to try to find the executable on the newPATH, and if it does find it then it uses it directly (see https://github.com/rust-lang/rust/blob/master/src/libstd/sys/windows/process.rs#L133-L149).
However, in the case of passing through to a node that doesn't exist, Rust looks for node and doesn't find it, so defaults to Windows' normal behavior, which uses the Volta shim's PATH to find node, meaning it finds the shim itself again, and again, and again, until the OS breaks the chain of nested calls. When we use cmd.exe /C <command>, we get an extra layer that makes the PATHs work out, but we run into the error message issues.
To properly support passthrough with correct PATH semantics and good error messages, we may need to create our own windows Command wrapper that provides a similar layer as calling cmd.exe, but also provides a method for informing the top-level Volta process of it's inability to locate a command.
If you don't have a default Node selected and have no Node available elsewhere on the system, running
node
on Windows results in the error message:'node' is not recognized as an internal or external command, operable program or batch file
I believe this is the result of the passthrough calling
node
with the non-Volta path. On Unix, calling a non-existent command results in the call toCommand::status
returning anErr
. On Windows, it results in anOk
with a status code of 1. If possible, we should detect this situation and show the Volta error.One possibility would be to use
which
to see if there is something on the system path namednode
and only pass through if that succeeds.The text was updated successfully, but these errors were encountered: