Missing space in Windows cmd.exe invocation breaks shell command invocation on Wine
|Reported by:||A1kmm||Owned by:|
|Type of failure:||Incorrect result at runtime||Test Case:|
|Related Tickets:||Differential Rev(s):|
Consider this code example:
import System.Process main = system "ghc --version"
When compiled and run on Wine, using process-22.214.171.124 or the latest version pushed to the git repository at the time of writing, the result is a cmd.exe prompt appears, rather than giving the current ghc version; the program exits when exit is typed into the shell without displaying the ghc version.
The reason for this is that System/Process/Internals.hs builds the command line like this: translate cmd ++ "/c " ++ string
The fact that there is no space between the path to cmd.exe and the /c argument causes Wine to ignore the /c flag (which would otherwise tell it to execute a command from the command line, rather than run in interactive mode).
I attach a patch which fixes this problem.