Skip to content

Missing space in Windows cmd.exe invocation breaks shell command invocation on Wine

Consider this code example:

import System.Process

main = system "ghc --version"

When compiled and run on Wine, using process-1.1.0.0 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.

Trac metadata
Trac field Value
Version 7.2.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/process
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information