Cannot specify argv with createProcess
There are conditions where it is important to specify the value of argv as distinct from the FilePath of the file to execute.
When createProcess is called with CmdSpec (inside the CreateProcess argument) of RawCommand, the code in System.Process.Internals.runGenProcess_ builds the argv list by concatenating the FilePath of the command to run on to the supplied args, then passing that array to the c code runInteractiveProcess. runInteractiveProcess in turn uses argv as the initial argument to either execvp() or execvpe(). Thus, argv, and the command to execute must be the same.
The fix is simple, but long.... runInteractiveProcess should take an adiditional parameter that is the command to exec, distinct from the args array (which continues to hold the now distinct argv). runGenProcess_ should keep cmd and args distinct, and build cstrs from args, not cmd:args. commandToProcess needs to then take on the work of prepending the cmd to the args array, in the case of RawCommand or ShellCommand. NOW, we can introduce a new constructore RawCommandWithArg0 FilePath String [String] where argv is specified, and commandToProcess for that can easily build the args from that parameter.
I should probably prepare a patch for this.... But I wanted to get the ticket in as the issue was fresh in my mind.
This is a feature request, but realize that without a change, an important part of POSIX support is missing.