-
-
Couldn't load subscription status.
- Fork 5.7k
Description
As discussed in JuliaPy/Conda.jl#17, we really need an api like windows_verbatim(cmd) that is a no-op on Unix but sets the UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS flag on the command on Windows.
The reason is that, basically, Windows process spawning is completely insane, and how you pass arguments changes on a program-by-program basis.
On Unix, when you spawn a process, you pass a list of strings that are the arguments. On Windows, you pass a single string that represents the entire "command line", and the program is responsible for getting the command line and parsing it into arguments. Usually, programs do this parsing by splitting arguments at spaces, which means that passing arguments containing spaces depends on how the program did the parsing.
- By default, libuv surrounds arguments containing spaces/tabs (or empty arguments) in double quotes
"and backslash-escapes"and\. This will, however, confuse programs that don't look for these things when they parse their arguments. - libuv provides an option called
UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS. If you set this option flag in theuv_process_thandle, then no quoting or escaping is done and the arguments are pasted verbatim into the "command-line" string. It is then up to the program to detect arguments that had spaces etc.
The Miniconda installer program expects the verbatim arguments to be passed, without quoting. We can do a crude simulation of this in Conda.jl by calling split on the arguments to break them into multiple arguments, but this doesn't handle arguments containing multiple consecutive spaces correctly. We really need a Julia API for UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS, because there is no single correct answer here.